]> git.notmuchmail.org Git - notmuch/blobdiff - database.cc
Drop dead function add_term.
[notmuch] / database.cc
index ea20705509060334b181f40db5d5254a326720f0..3cbab9f067d64b708f2328315eb02ffce451293b 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:
@@ -170,29 +172,6 @@ notmuch_status_to_string (notmuch_status_t status)
     }
 }
 
-/* XXX: We should drop this function and convert all callers to call
- * _notmuch_message_add_term instead. */
-static void
-add_term (Xapian::Document doc,
-         const char *prefix_name,
-         const char *value)
-{
-    const char *prefix;
-    char *term;
-
-    if (value == NULL)
-       return;
-
-    prefix = _find_prefix (prefix_name);
-
-    term = g_strdup_printf ("%s%s", prefix, value);
-
-    if (strlen (term) <= NOTMUCH_TERM_MAX)
-       doc.add_term (term);
-
-    g_free (term);
-}
-
 static void
 find_doc_ids (notmuch_database_t *notmuch,
              const char *prefix_name,
@@ -519,7 +498,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 +602,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 +777,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