X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch.h;h=df432bcc6605f5ddfb14e672bde30383e59ac37e;hp=6d81fb6ca08a0a0601a767d5238c39badbb9994d;hb=6519aff957df7a69d86ed9a00707c911d60259f6;hpb=466a7bbf620e4bf1b57097a6d3c474159c475b6d diff --git a/notmuch.h b/notmuch.h index 6d81fb6c..df432bcc 100644 --- a/notmuch.h +++ b/notmuch.h @@ -174,9 +174,8 @@ notmuch_database_add_message (notmuch_database_t *database, * * http://xapian.org/docs/queryparser.html * - * As a special case, passing a value of NOTMUCH_QUERY_ALL for the - * query string will result in a query that returns all messages in - * the database. + * As a special case, passing a length-zero string, (that is ""), will + * result in a query that returns all messages in the database. * * See notmuch_query_set_sort for controlling the order of results and * notmuch_query_search to actually execute the query. @@ -190,10 +189,6 @@ notmuch_query_t * notmuch_query_create (notmuch_database_t *database, const char *query_string); -/* Special value to cause notmuch_query_create to return all - * messages. */ -extern const char *NOTMUCH_QUERY_ALL; - /* Sort values for notmuch_query_set_sort */ typedef enum { NOTMUCH_SORT_DATE_OLDEST_FIRST, @@ -226,8 +221,13 @@ notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort); * * notmuch_query_destroy (query); * - * Note that there's no explicit destructor for the notmuch_results_t - * object. + * Note that there's no explicit destructor needed for the + * notmuch_results_t object. + * + * (For consistency, we do provide a notmuch_results_destroy function, + * but there's no point in calling it if you're about to destroy the + * query object as well too---either call will free all the memory of + * the results). */ notmuch_results_t * notmuch_query_search (notmuch_query_t *query); @@ -272,6 +272,15 @@ notmuch_results_get (notmuch_results_t *results); void notmuch_results_advance (notmuch_results_t *results); +/* Destroy a notmuch_results_t object. + * + * It's not strictly necessary to call this function. All memory from + * the notmuch_results_t object will be reclaimed when the containg + * query object is destroyed. + */ +void +notmuch_results_destroy (notmuch_results_t *results); + /* Get the message ID of 'message'. * * The returned string belongs to 'message' and as such, should not be @@ -305,12 +314,25 @@ notmuch_message_get_message_id (notmuch_message_t *message); * .... * } * - * Note that there's no explicit destructor for the notmuch_tags_t - * object. + * Note: If you are finished with a message before its containing + * query, you can call notmuch_message_destroy to clean up some memory + * sooner. If you don't call it, all the memory will still be + * reclaimed when the query is destroyed. */ notmuch_tags_t * notmuch_message_get_tags (notmuch_message_t *message); +/* Destroy a notmuch_message_t object. + * + * It can be useful to call this function in the case of a single + * query object with many messages in the result, (such as iterating + * over the entire database). Otherwise, it's fine to never call this + * function and there will still be no memory leaks. (The memory from + * the messages get reclaimed when the containing query is destroyed.) + */ +void +notmuch_message_destroy (notmuch_message_t *message); + /* Does the given notmuch_tags_t object contain any more results. * * When this function returns TRUE, notmuch_tags_get will return a @@ -342,6 +364,15 @@ notmuch_tags_get (notmuch_tags_t *tags); void notmuch_tags_advance (notmuch_tags_t *results); +/* Destroy a notmuch_tags_t object. + * + * It's not strictly necessary to call this function. All memory from + * the notmuch_tags_t object will be reclaimed when the containg + * message or query objects are destroyed. + */ +void +notmuch_tags_destroy (notmuch_tags_t *tags); + NOTMUCH_END_DECLS #endif