]> git.notmuchmail.org Git - notmuch/blobdiff - database.cc
Add -Wswitch-enum and fix warnings.
[notmuch] / database.cc
index ea20705509060334b181f40db5d5254a326720f0..b1b95e9dd6fdf02dc3b1d1917f1cddb0adbf2e7a 100644 (file)
@@ -152,6 +152,8 @@ notmuch_status_to_string (notmuch_status_t status)
     switch (status) {
     case NOTMUCH_STATUS_SUCCESS:
        return "No error occurred";
+    case NOTMUCH_STATUS_OUT_OF_MEMORY:
+       return "Out of memory";
     case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
        return "A Xapian exception occurred";
     case NOTMUCH_STATUS_FILE_ERROR:
@@ -519,7 +521,7 @@ notmuch_database_get_path (notmuch_database_t *notmuch)
     return notmuch->path;
 }
 
-notmuch_private_status_t
+static notmuch_private_status_t
 find_timestamp_document (notmuch_database_t *notmuch, const char *db_key,
                         Xapian::Document *doc, unsigned int *doc_id)
 {
@@ -623,7 +625,7 @@ notmuch_database_get_timestamp (notmuch_database_t *notmuch, const char *key)
  *
  * Otherwise, returns a newly talloced string belonging to 'ctx'.
  */
-const char *
+static const char *
 _resolve_message_id_to_thread_id (notmuch_database_t *notmuch,
                                  void *ctx,
                                  const char *message_id)
@@ -798,20 +800,24 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,
                                notmuch_message_t *message,
                                notmuch_message_file_t *message_file)
 {
-    notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
+    notmuch_status_t status;
     const char *thread_id = NULL;
 
-    _notmuch_database_link_message_to_parents (notmuch, message,
-                                              message_file,
-                                              &thread_id);
+    status = _notmuch_database_link_message_to_parents (notmuch, message,
+                                                       message_file,
+                                                       &thread_id);
+    if (status)
+       return status;
 
-    ret = _notmuch_database_link_message_to_children (notmuch, message,
-                                                     &thread_id);
+    status = _notmuch_database_link_message_to_children (notmuch, message,
+                                                        &thread_id);
+    if (status)
+       return status;
 
     if (thread_id == NULL)
        _notmuch_message_ensure_thread_id (message);
 
-    return ret;
+    return NOTMUCH_STATUS_SUCCESS;
 }
 
 notmuch_status_t