X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch.h;h=ef29fb57507ed6e6caae96468a761a0aef7dc650;hb=ec77f6b50cb460dc8c376eeee045a25ed390c337;hp=103d233118e0d4f27f0e46770809ec6cc3e8df73;hpb=03c40c2bb04a762539e5fbc9924a1ce1e5548cc8;p=notmuch diff --git a/notmuch.h b/notmuch.h index 103d2331..ef29fb57 100644 --- a/notmuch.h +++ b/notmuch.h @@ -51,6 +51,8 @@ typedef int notmuch_bool_t; * * NOTMUCH_STATUS_SUCCESS: No error occurred. * + * NOTMUCH_STATUS_OUT_OF_MEMORY: Out of memory + * * XXX: We don't really want to expose this lame XAPIAN_EXCEPTION * value. Instead we should map to things like DATABASE_LOCKED or * whatever. @@ -78,6 +80,7 @@ typedef int notmuch_bool_t; */ typedef enum _notmuch_status { NOTMUCH_STATUS_SUCCESS = 0, + NOTMUCH_STATUS_OUT_OF_MEMORY, NOTMUCH_STATUS_XAPIAN_EXCEPTION, NOTMUCH_STATUS_FILE_ERROR, NOTMUCH_STATUS_FILE_NOT_EMAIL, @@ -104,6 +107,19 @@ typedef struct _notmuch_message notmuch_message_t; typedef struct _notmuch_tags notmuch_tags_t; typedef struct _notmuch_thread_ids notmuch_thread_ids_t; +/* Lookup the default database path. + * + * This is the path that will be used by notmuch_database_create and + * notmuch_database_open if given a NULL path. Specifically it will be + * the value of the NOTMUCH_BASE environment variable if set, + * otherwise ${HOME}/mail + * + * Returns a newly allocated string which the caller should free() + * when finished with it. + */ +char * +notmuch_database_default_path (void); + /* Create a new, empty notmuch database located at 'path'. * * The path should be a top-level directory to a collection of @@ -131,6 +147,9 @@ typedef struct _notmuch_thread_ids notmuch_thread_ids_t; notmuch_database_t * notmuch_database_create (const char *path); +/* XXX: I think I'd like this to take an extra argument of + * notmuch_status_t* for returning a status value on failure. */ + /* Open a an existing notmuch database located at 'path'. * * The database should have been created at some time in the past, @@ -159,19 +178,6 @@ notmuch_database_open (const char *path); void notmuch_database_close (notmuch_database_t *database); -/* Lookup the default database path. - * - * This is the path that will be used by notmuch_database_create and - * notmuch_database_open if given a NULL path. Specifically it will be - * the value of the NOTMUCH_BASE environment variable if set, - * otherwise ${HOME}/mail - * - * Returns a newly allocated string which the caller should free() - * when finished with it. - */ -char * -notmuch_database_default_path (void); - /* Return the database path of the given database. * * The return value is a string owned by notmuch so should not be @@ -264,8 +270,8 @@ notmuch_database_add_message (notmuch_database_t *database, * a new notmuch_message_t object is returned. The caller should call * notmuch_message_destroy when done with the message. * - * If no message is found with the given message_id, this function - * returns NULL. + * If no message is found with the given message_id or if an + * out-of-memory situation occurs, this function returns NULL. */ notmuch_message_t * notmuch_database_find_message (notmuch_database_t *database, @@ -373,6 +379,9 @@ notmuch_results_has_more (notmuch_results_t *results); * * See the documentation of notmuch_query_search for example code * showing how to iterate over a notmuch_results_t object. + * + * If an out-of-memory situation occurs, this function will return + * NULL. */ notmuch_message_t * notmuch_results_get (notmuch_results_t *results);