mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 03:48:10 +01:00
lib: run uncrustify
This is the result of running $ uncrustify --replace --config ../devel/uncrustify.cfg *.c *.h *.cc in the lib directory
This commit is contained in:
parent
8a3f86f2f9
commit
2b62ca2e3b
24 changed files with 513 additions and 513 deletions
|
@ -1182,7 +1182,9 @@ class NotmuchCompactor : public Xapian::Compactor
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NotmuchCompactor(notmuch_compact_status_cb_t cb, void *closure) :
|
NotmuchCompactor(notmuch_compact_status_cb_t cb, void *closure) :
|
||||||
status_cb (cb), status_closure (closure) { }
|
status_cb (cb), status_closure (closure)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
set_status (const std::string &table, const std::string &status)
|
set_status (const std::string &table, const std::string &status)
|
||||||
|
@ -1265,8 +1267,7 @@ notmuch_database_compact (const char *path,
|
||||||
goto DONE;
|
goto DONE;
|
||||||
}
|
}
|
||||||
keep_backup = false;
|
keep_backup = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
keep_backup = true;
|
keep_backup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1510,8 +1511,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
|
||||||
goto DONE;
|
goto DONE;
|
||||||
for (;
|
for (;
|
||||||
notmuch_messages_valid (messages);
|
notmuch_messages_valid (messages);
|
||||||
notmuch_messages_move_to_next (messages))
|
notmuch_messages_move_to_next (messages)) {
|
||||||
{
|
|
||||||
if (do_progress_notify) {
|
if (do_progress_notify) {
|
||||||
progress_notify (closure, (double) count / total);
|
progress_notify (closure, (double) count / total);
|
||||||
do_progress_notify = 0;
|
do_progress_notify = 0;
|
||||||
|
@ -1568,8 +1568,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
|
||||||
|
|
||||||
for (t = notmuch->xapian_db->allterms_begin ("XTIMESTAMP");
|
for (t = notmuch->xapian_db->allterms_begin ("XTIMESTAMP");
|
||||||
t != t_end;
|
t != t_end;
|
||||||
t++)
|
t++) {
|
||||||
{
|
|
||||||
Xapian::PostingIterator p, p_end;
|
Xapian::PostingIterator p, p_end;
|
||||||
std::string term = *t;
|
std::string term = *t;
|
||||||
|
|
||||||
|
@ -1577,8 +1576,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
|
||||||
|
|
||||||
for (p = notmuch->xapian_db->postlist_begin (term);
|
for (p = notmuch->xapian_db->postlist_begin (term);
|
||||||
p != p_end;
|
p != p_end;
|
||||||
p++)
|
p++) {
|
||||||
{
|
|
||||||
Xapian::Document document;
|
Xapian::Document document;
|
||||||
time_t mtime;
|
time_t mtime;
|
||||||
notmuch_directory_t *directory;
|
notmuch_directory_t *directory;
|
||||||
|
@ -1953,8 +1951,7 @@ _notmuch_database_relative_path (notmuch_database_t *notmuch,
|
||||||
while (*relative == '/' && *(relative + 1) == '/')
|
while (*relative == '/' && *(relative + 1) == '/')
|
||||||
relative++;
|
relative++;
|
||||||
|
|
||||||
if (strncmp (relative, db_path, db_path_len) == 0)
|
if (strncmp (relative, db_path, db_path_len) == 0) {
|
||||||
{
|
|
||||||
relative += db_path_len;
|
relative += db_path_len;
|
||||||
while (*relative == '/')
|
while (*relative == '/')
|
||||||
relative++;
|
relative++;
|
||||||
|
|
35
lib/index.cc
35
lib/index.cc
|
@ -59,21 +59,21 @@ static const scanner_state_t uuencode_states[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The following table is intended to implement this DFA (in 'dot'
|
/* The following table is intended to implement this DFA (in 'dot'
|
||||||
format). Note that 2 and 3 are "hidden" states used to step through
|
* format). Note that 2 and 3 are "hidden" states used to step through
|
||||||
the possible out edges of state 1.
|
* the possible out edges of state 1.
|
||||||
|
*
|
||||||
digraph html_filter {
|
* digraph html_filter {
|
||||||
0 -> 1 [label="<"];
|
* 0 -> 1 [label="<"];
|
||||||
0 -> 0;
|
* 0 -> 0;
|
||||||
1 -> 4 [label="'"];
|
* 1 -> 4 [label="'"];
|
||||||
1 -> 5 [label="\""];
|
* 1 -> 5 [label="\""];
|
||||||
1 -> 0 [label=">"];
|
* 1 -> 0 [label=">"];
|
||||||
1 -> 1;
|
* 1 -> 1;
|
||||||
4 -> 1 [label="'"];
|
* 4 -> 1 [label="'"];
|
||||||
4 -> 4;
|
* 4 -> 4;
|
||||||
5 -> 1 [label="\""];
|
* 5 -> 1 [label="\""];
|
||||||
5 -> 5;
|
* 5 -> 5;
|
||||||
}
|
* }
|
||||||
*/
|
*/
|
||||||
static const int first_html_skipping_state = 1;
|
static const int first_html_skipping_state = 1;
|
||||||
static const scanner_state_t html_states[] = {
|
static const scanner_state_t html_states[] = {
|
||||||
|
@ -168,6 +168,7 @@ static GMimeFilter *
|
||||||
filter_copy (GMimeFilter *gmime_filter)
|
filter_copy (GMimeFilter *gmime_filter)
|
||||||
{
|
{
|
||||||
NotmuchFilterDiscardNonTerm *filter = (NotmuchFilterDiscardNonTerm *) gmime_filter;
|
NotmuchFilterDiscardNonTerm *filter = (NotmuchFilterDiscardNonTerm *) gmime_filter;
|
||||||
|
|
||||||
return notmuch_filter_discard_non_term_new (filter->content_type);
|
return notmuch_filter_discard_non_term_new (filter->content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,6 +357,7 @@ static void
|
||||||
_index_content_type (notmuch_message_t *message, GMimeObject *part)
|
_index_content_type (notmuch_message_t *message, GMimeObject *part)
|
||||||
{
|
{
|
||||||
GMimeContentType *content_type = g_mime_object_get_content_type (part);
|
GMimeContentType *content_type = g_mime_object_get_content_type (part);
|
||||||
|
|
||||||
if (content_type) {
|
if (content_type) {
|
||||||
char *mime_string = g_mime_content_type_get_mime_type (content_type);
|
char *mime_string = g_mime_content_type_get_mime_type (content_type);
|
||||||
if (mime_string) {
|
if (mime_string) {
|
||||||
|
@ -464,8 +466,7 @@ _index_mime_part (notmuch_message_t *message,
|
||||||
disposition = g_mime_object_get_content_disposition (part);
|
disposition = g_mime_object_get_content_disposition (part);
|
||||||
if (disposition &&
|
if (disposition &&
|
||||||
strcasecmp (g_mime_content_disposition_get_disposition (disposition),
|
strcasecmp (g_mime_content_disposition_get_disposition (disposition),
|
||||||
GMIME_DISPOSITION_ATTACHMENT) == 0)
|
GMIME_DISPOSITION_ATTACHMENT) == 0) {
|
||||||
{
|
|
||||||
const char *filename = g_mime_part_get_filename (GMIME_PART (part));
|
const char *filename = g_mime_part_get_filename (GMIME_PART (part));
|
||||||
|
|
||||||
_notmuch_message_add_term (message, "tag", "attachment");
|
_notmuch_message_add_term (message, "tag", "attachment");
|
||||||
|
|
|
@ -24,6 +24,7 @@ notmuch_indexopts_t *
|
||||||
notmuch_database_get_default_indexopts (notmuch_database_t *db)
|
notmuch_database_get_default_indexopts (notmuch_database_t *db)
|
||||||
{
|
{
|
||||||
notmuch_indexopts_t *ret = talloc_zero (db, notmuch_indexopts_t);
|
notmuch_indexopts_t *ret = talloc_zero (db, notmuch_indexopts_t);
|
||||||
|
|
||||||
if (! ret)
|
if (! ret)
|
||||||
return ret;
|
return ret;
|
||||||
ret->crypto.decrypt = NOTMUCH_DECRYPT_AUTO;
|
ret->crypto.decrypt = NOTMUCH_DECRYPT_AUTO;
|
||||||
|
|
|
@ -201,7 +201,8 @@ _notmuch_message_file_get_mime_message (notmuch_message_file_t *message,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_extend_header (char *combined, const char *value) {
|
_extend_header (char *combined, const char *value)
|
||||||
|
{
|
||||||
char *decoded;
|
char *decoded;
|
||||||
|
|
||||||
decoded = g_mime_utils_header_decode_text (NULL, value);
|
decoded = g_mime_utils_header_decode_text (NULL, value);
|
||||||
|
|
|
@ -150,6 +150,7 @@ notmuch_message_properties_t *
|
||||||
notmuch_message_get_properties (notmuch_message_t *message, const char *key, notmuch_bool_t exact)
|
notmuch_message_get_properties (notmuch_message_t *message, const char *key, notmuch_bool_t exact)
|
||||||
{
|
{
|
||||||
notmuch_string_map_t *map;
|
notmuch_string_map_t *map;
|
||||||
|
|
||||||
map = _notmuch_message_property_map (message);
|
map = _notmuch_message_property_map (message);
|
||||||
return _notmuch_string_map_iterator_create (map, key, exact);
|
return _notmuch_string_map_iterator_create (map, key, exact);
|
||||||
}
|
}
|
||||||
|
|
|
@ -604,7 +604,8 @@ _notmuch_message_add_reply (notmuch_message_t *message,
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
_notmuch_message_get_thread_depth (notmuch_message_t *message) {
|
_notmuch_message_get_thread_depth (notmuch_message_t *message)
|
||||||
|
{
|
||||||
return message->thread_depth;
|
return message->thread_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,7 +778,8 @@ _notmuch_message_remove_indexed_terms (notmuch_message_t *message)
|
||||||
|
|
||||||
|
|
||||||
/* Return true if p points at "new" or "cur". */
|
/* Return true if p points at "new" or "cur". */
|
||||||
static bool is_maildir (const char *p)
|
static bool
|
||||||
|
is_maildir (const char *p)
|
||||||
{
|
{
|
||||||
return strcmp (p, "cur") == 0 || strcmp (p, "new") == 0;
|
return strcmp (p, "cur") == 0 || strcmp (p, "new") == 0;
|
||||||
}
|
}
|
||||||
|
@ -1108,8 +1110,7 @@ notmuch_message_get_filename (notmuch_message_t *message)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (message->filename_list->head == NULL ||
|
if (message->filename_list->head == NULL ||
|
||||||
message->filename_list->head->string == NULL)
|
message->filename_list->head->string == NULL) {
|
||||||
{
|
|
||||||
INTERNAL_ERROR ("message with no filename");
|
INTERNAL_ERROR ("message with no filename");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1339,8 +1340,8 @@ _notmuch_message_delete (notmuch_message_t *message)
|
||||||
_notmuch_message_sync (ghost);
|
_notmuch_message_sync (ghost);
|
||||||
} else if (private_status == NOTMUCH_PRIVATE_STATUS_SUCCESS) {
|
} else if (private_status == NOTMUCH_PRIVATE_STATUS_SUCCESS) {
|
||||||
/* this is deeply weird, and we should not have gotten
|
/* this is deeply weird, and we should not have gotten
|
||||||
into this state. is there a better error message to
|
* into this state. is there a better error message to
|
||||||
return here? */
|
* return here? */
|
||||||
status = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
|
status = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1635,8 +1636,7 @@ _filename_is_in_maildir (const char *filename)
|
||||||
dir = slash + 1;
|
dir = slash + 1;
|
||||||
|
|
||||||
if (STRNCMP_LITERAL (dir, "cur/") == 0 ||
|
if (STRNCMP_LITERAL (dir, "cur/") == 0 ||
|
||||||
STRNCMP_LITERAL (dir, "new/") == 0)
|
STRNCMP_LITERAL (dir, "new/") == 0) {
|
||||||
{
|
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1661,8 +1661,7 @@ _ensure_maildir_flags (notmuch_message_t *message, bool force)
|
||||||
|
|
||||||
for (filenames = notmuch_message_get_filenames (message);
|
for (filenames = notmuch_message_get_filenames (message);
|
||||||
notmuch_filenames_valid (filenames);
|
notmuch_filenames_valid (filenames);
|
||||||
notmuch_filenames_move_to_next (filenames))
|
notmuch_filenames_move_to_next (filenames)) {
|
||||||
{
|
|
||||||
filename = notmuch_filenames_get (filenames);
|
filename = notmuch_filenames_get (filenames);
|
||||||
dir = _filename_is_in_maildir (filename);
|
dir = _filename_is_in_maildir (filename);
|
||||||
|
|
||||||
|
@ -1715,8 +1714,7 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)
|
||||||
for (i = 0; i < ARRAY_SIZE (flag2tag); i++) {
|
for (i = 0; i < ARRAY_SIZE (flag2tag); i++) {
|
||||||
if ((strchr (message->maildir_flags, flag2tag[i].flag) != NULL)
|
if ((strchr (message->maildir_flags, flag2tag[i].flag) != NULL)
|
||||||
^
|
^
|
||||||
flag2tag[i].inverse)
|
flag2tag[i].inverse) {
|
||||||
{
|
|
||||||
status = notmuch_message_add_tag (message, flag2tag[i].tag);
|
status = notmuch_message_add_tag (message, flag2tag[i].tag);
|
||||||
} else {
|
} else {
|
||||||
status = notmuch_message_remove_tag (message, flag2tag[i].tag);
|
status = notmuch_message_remove_tag (message, flag2tag[i].tag);
|
||||||
|
@ -1751,8 +1749,7 @@ _get_maildir_flag_actions (notmuch_message_t *message,
|
||||||
/* First, find flags for all set tags. */
|
/* First, find flags for all set tags. */
|
||||||
for (tags = notmuch_message_get_tags (message);
|
for (tags = notmuch_message_get_tags (message);
|
||||||
notmuch_tags_valid (tags);
|
notmuch_tags_valid (tags);
|
||||||
notmuch_tags_move_to_next (tags))
|
notmuch_tags_move_to_next (tags)) {
|
||||||
{
|
|
||||||
tag = notmuch_tags_get (tags);
|
tag = notmuch_tags_get (tags);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE (flag2tag); i++) {
|
for (i = 0; i < ARRAY_SIZE (flag2tag); i++) {
|
||||||
|
@ -1827,8 +1824,7 @@ _new_maildir_filename (void *ctx,
|
||||||
/* Loop through existing flags in filename. */
|
/* Loop through existing flags in filename. */
|
||||||
for (flags = info + 3, last_flag = 0;
|
for (flags = info + 3, last_flag = 0;
|
||||||
*flags;
|
*flags;
|
||||||
last_flag = flag, flags++)
|
last_flag = flag, flags++) {
|
||||||
{
|
|
||||||
flag = *flags;
|
flag = *flags;
|
||||||
|
|
||||||
/* Original flags not in ASCII order. Abort. */
|
/* Original flags not in ASCII order. Abort. */
|
||||||
|
@ -1885,8 +1881,7 @@ _new_maildir_filename (void *ctx,
|
||||||
strcat (filename_new, ":2,");
|
strcat (filename_new, ":2,");
|
||||||
|
|
||||||
s = filename_new + strlen (filename_new);
|
s = filename_new + strlen (filename_new);
|
||||||
for (i = 0; i < sizeof (flag_map); i++)
|
for (i = 0; i < sizeof (flag_map); i++) {
|
||||||
{
|
|
||||||
if (flag_map[i]) {
|
if (flag_map[i]) {
|
||||||
*s = i;
|
*s = i;
|
||||||
s++;
|
s++;
|
||||||
|
@ -1915,8 +1910,7 @@ notmuch_message_tags_to_maildir_flags (notmuch_message_t *message)
|
||||||
|
|
||||||
for (filenames = notmuch_message_get_filenames (message);
|
for (filenames = notmuch_message_get_filenames (message);
|
||||||
notmuch_filenames_valid (filenames);
|
notmuch_filenames_valid (filenames);
|
||||||
notmuch_filenames_move_to_next (filenames))
|
notmuch_filenames_move_to_next (filenames)) {
|
||||||
{
|
|
||||||
filename = notmuch_filenames_get (filenames);
|
filename = notmuch_filenames_get (filenames);
|
||||||
|
|
||||||
if (! _filename_is_in_maildir (filename))
|
if (! _filename_is_in_maildir (filename))
|
||||||
|
@ -1978,8 +1972,7 @@ notmuch_message_remove_all_tags (notmuch_message_t *message)
|
||||||
|
|
||||||
for (tags = notmuch_message_get_tags (message);
|
for (tags = notmuch_message_get_tags (message);
|
||||||
notmuch_tags_valid (tags);
|
notmuch_tags_valid (tags);
|
||||||
notmuch_tags_move_to_next (tags))
|
notmuch_tags_move_to_next (tags)) {
|
||||||
{
|
|
||||||
tag = notmuch_tags_get (tags);
|
tag = notmuch_tags_get (tags);
|
||||||
|
|
||||||
private_status = _notmuch_message_remove_term (message, "tag", tag);
|
private_status = _notmuch_message_remove_term (message, "tag", tag);
|
||||||
|
|
|
@ -83,7 +83,7 @@ NOTMUCH_BEGIN_DECLS
|
||||||
/* these macros gain us a few percent of speed on gcc */
|
/* these macros gain us a few percent of speed on gcc */
|
||||||
#if (__GNUC__ >= 3)
|
#if (__GNUC__ >= 3)
|
||||||
/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1
|
/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1
|
||||||
as its first argument */
|
* as its first argument */
|
||||||
#ifndef likely
|
#ifndef likely
|
||||||
#define likely(x) __builtin_expect (! ! (x), 1)
|
#define likely(x) __builtin_expect (! ! (x), 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1100,7 +1100,7 @@ notmuch_query_count_messages_st (notmuch_query_t *query, unsigned int *count);
|
||||||
*
|
*
|
||||||
* NOTMUCH_STATUS_OUT_OF_MEMORY: Memory allocation failed. The value
|
* NOTMUCH_STATUS_OUT_OF_MEMORY: Memory allocation failed. The value
|
||||||
* of *count is not defined
|
* of *count is not defined
|
||||||
|
*
|
||||||
* NOTMUCH_STATUS_SUCCESS: query completed successfully.
|
* NOTMUCH_STATUS_SUCCESS: query completed successfully.
|
||||||
*
|
*
|
||||||
* NOTMUCH_STATUS_XAPIAN_EXCEPTION: a Xapian exception occurred. The
|
* NOTMUCH_STATUS_XAPIAN_EXCEPTION: a Xapian exception occurred. The
|
||||||
|
|
|
@ -67,7 +67,9 @@ ParseTimeValueRangeProcessor::operator() (std::string &begin, std::string &end)
|
||||||
|
|
||||||
#if HAVE_XAPIAN_FIELD_PROCESSOR
|
#if HAVE_XAPIAN_FIELD_PROCESSOR
|
||||||
/* XXX TODO: is throwing an exception the right thing to do here? */
|
/* XXX TODO: is throwing an exception the right thing to do here? */
|
||||||
Xapian::Query DateFieldProcessor::operator()(const std::string & str) {
|
Xapian::Query
|
||||||
|
DateFieldProcessor::operator() (const std::string & str)
|
||||||
|
{
|
||||||
time_t from, to, now;
|
time_t from, to, now;
|
||||||
|
|
||||||
/* Use the same 'now' for begin and end. */
|
/* Use the same 'now' for begin and end. */
|
||||||
|
|
|
@ -32,7 +32,9 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ParseTimeValueRangeProcessor (Xapian::valueno slot_)
|
ParseTimeValueRangeProcessor (Xapian::valueno slot_)
|
||||||
: valno(slot_) { }
|
: valno (slot_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Xapian::valueno operator() (std::string &begin, std::string &end);
|
Xapian::valueno operator() (std::string &begin, std::string &end);
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,7 +34,9 @@ class QueryFieldProcessor : public Xapian::FieldProcessor {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QueryFieldProcessor (Xapian::QueryParser &parser_, notmuch_database_t *notmuch_)
|
QueryFieldProcessor (Xapian::QueryParser &parser_, notmuch_database_t *notmuch_)
|
||||||
: parser(parser_), notmuch(notmuch_) { };
|
: parser (parser_), notmuch (notmuch_)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
Xapian::Query operator() (const std::string & str);
|
Xapian::Query operator() (const std::string & str);
|
||||||
};
|
};
|
||||||
|
|
16
lib/query.cc
16
lib/query.cc
|
@ -71,12 +71,14 @@ static bool
|
||||||
_debug_query (void)
|
_debug_query (void)
|
||||||
{
|
{
|
||||||
char *env = getenv ("NOTMUCH_DEBUG_QUERY");
|
char *env = getenv ("NOTMUCH_DEBUG_QUERY");
|
||||||
|
|
||||||
return (env && strcmp (env, "") != 0);
|
return (env && strcmp (env, "") != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Explicit destructor call for placement new */
|
/* Explicit destructor call for placement new */
|
||||||
static int
|
static int
|
||||||
_notmuch_query_destructor (notmuch_query_t *query) {
|
_notmuch_query_destructor (notmuch_query_t *query)
|
||||||
|
{
|
||||||
query->xapian_query.~Query();
|
query->xapian_query.~Query();
|
||||||
query->terms.~set<std::string>();
|
query->terms.~set<std::string>();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -278,8 +280,7 @@ _notmuch_query_search_documents (notmuch_query_t *query,
|
||||||
Xapian::MSetIterator iterator;
|
Xapian::MSetIterator iterator;
|
||||||
|
|
||||||
if (strcmp (query_string, "") == 0 ||
|
if (strcmp (query_string, "") == 0 ||
|
||||||
strcmp (query_string, "*") == 0)
|
strcmp (query_string, "*") == 0) {
|
||||||
{
|
|
||||||
final_query = mail_query;
|
final_query = mail_query;
|
||||||
} else {
|
} else {
|
||||||
final_query = Xapian::Query (Xapian::Query::OP_AND,
|
final_query = Xapian::Query (Xapian::Query::OP_AND,
|
||||||
|
@ -291,8 +292,7 @@ _notmuch_query_search_documents (notmuch_query_t *query,
|
||||||
exclude_query = _notmuch_exclude_tags (query);
|
exclude_query = _notmuch_exclude_tags (query);
|
||||||
|
|
||||||
if (query->omit_excluded == NOTMUCH_EXCLUDE_TRUE ||
|
if (query->omit_excluded == NOTMUCH_EXCLUDE_TRUE ||
|
||||||
query->omit_excluded == NOTMUCH_EXCLUDE_ALL)
|
query->omit_excluded == NOTMUCH_EXCLUDE_ALL) {
|
||||||
{
|
|
||||||
final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
|
final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
|
||||||
final_query, exclude_query);
|
final_query, exclude_query);
|
||||||
} else { /* NOTMUCH_EXCLUDE_FLAG */
|
} else { /* NOTMUCH_EXCLUDE_FLAG */
|
||||||
|
@ -408,8 +408,7 @@ _notmuch_mset_messages_get (notmuch_messages_t *messages)
|
||||||
&status);
|
&status);
|
||||||
|
|
||||||
if (message == NULL &&
|
if (message == NULL &&
|
||||||
status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND)
|
status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) {
|
||||||
{
|
|
||||||
INTERNAL_ERROR ("a messages iterator contains a non-existent document ID.\n");
|
INTERNAL_ERROR ("a messages iterator contains a non-existent document ID.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,8 +623,7 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
|
||||||
Xapian::MSet mset;
|
Xapian::MSet mset;
|
||||||
|
|
||||||
if (strcmp (query_string, "") == 0 ||
|
if (strcmp (query_string, "") == 0 ||
|
||||||
strcmp (query_string, "*") == 0)
|
strcmp (query_string, "*") == 0) {
|
||||||
{
|
|
||||||
final_query = mail_query;
|
final_query = mail_query;
|
||||||
} else {
|
} else {
|
||||||
final_query = Xapian::Query (Xapian::Query::OP_AND,
|
final_query = Xapian::Query (Xapian::Query::OP_AND,
|
||||||
|
|
|
@ -129,7 +129,8 @@ RegexpPostingSource::check (Xapian::docid did, unused (double min_wt))
|
||||||
return (regexec (®exp_, (*it_).c_str (), 0, NULL, 0) == 0);
|
return (regexec (®exp_, (*it_).c_str (), 0, NULL, 0) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Xapian::valueno _find_slot (std::string prefix)
|
static inline Xapian::valueno
|
||||||
|
_find_slot (std::string prefix)
|
||||||
{
|
{
|
||||||
if (prefix == "from")
|
if (prefix == "from")
|
||||||
return NOTMUCH_VALUE_FROM;
|
return NOTMUCH_VALUE_FROM;
|
||||||
|
|
|
@ -73,7 +73,9 @@ class RegexpFieldProcessor : public Xapian::FieldProcessor {
|
||||||
RegexpFieldProcessor (std::string prefix, notmuch_field_flag_t options,
|
RegexpFieldProcessor (std::string prefix, notmuch_field_flag_t options,
|
||||||
Xapian::QueryParser &parser_, notmuch_database_t *notmuch_);
|
Xapian::QueryParser &parser_, notmuch_database_t *notmuch_);
|
||||||
|
|
||||||
~RegexpFieldProcessor () { };
|
~RegexpFieldProcessor ()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
Xapian::Query operator() (const std::string & str);
|
Xapian::Query operator() (const std::string & str);
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,6 +55,7 @@ char *
|
||||||
_notmuch_sha1_of_file (const char *filename)
|
_notmuch_sha1_of_file (const char *filename)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
#define BLOCK_SIZE 4096
|
#define BLOCK_SIZE 4096
|
||||||
unsigned char block[BLOCK_SIZE];
|
unsigned char block[BLOCK_SIZE];
|
||||||
size_t bytes_read;
|
size_t bytes_read;
|
||||||
|
|
|
@ -34,7 +34,9 @@ class ThreadFieldProcessor : public Xapian::FieldProcessor {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ThreadFieldProcessor (Xapian::QueryParser &parser_, notmuch_database_t *notmuch_)
|
ThreadFieldProcessor (Xapian::QueryParser &parser_, notmuch_database_t *notmuch_)
|
||||||
: parser(parser_), notmuch(notmuch_) { };
|
: parser (parser_), notmuch (notmuch_)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
Xapian::Query operator() (const std::string & str);
|
Xapian::Query operator() (const std::string & str);
|
||||||
};
|
};
|
||||||
|
|
|
@ -251,14 +251,12 @@ _thread_add_message (notmuch_thread_t *thread,
|
||||||
if (omit_exclude != NOTMUCH_EXCLUDE_FALSE) {
|
if (omit_exclude != NOTMUCH_EXCLUDE_FALSE) {
|
||||||
for (tags = notmuch_message_get_tags (message);
|
for (tags = notmuch_message_get_tags (message);
|
||||||
notmuch_tags_valid (tags);
|
notmuch_tags_valid (tags);
|
||||||
notmuch_tags_move_to_next (tags))
|
notmuch_tags_move_to_next (tags)) {
|
||||||
{
|
|
||||||
tag = notmuch_tags_get (tags);
|
tag = notmuch_tags_get (tags);
|
||||||
/* Is message excluded? */
|
/* Is message excluded? */
|
||||||
for (notmuch_string_node_t *term = exclude_terms->head;
|
for (notmuch_string_node_t *term = exclude_terms->head;
|
||||||
term != NULL;
|
term != NULL;
|
||||||
term = term->next)
|
term = term->next) {
|
||||||
{
|
|
||||||
/* Check for an empty string, and then ignore initial 'K'. */
|
/* Check for an empty string, and then ignore initial 'K'. */
|
||||||
if (*(term->string) && strcmp (tag, (term->string + 1)) == 0) {
|
if (*(term->string) && strcmp (tag, (term->string + 1)) == 0) {
|
||||||
message_excluded = true;
|
message_excluded = true;
|
||||||
|
@ -309,8 +307,7 @@ _thread_add_message (notmuch_thread_t *thread,
|
||||||
|
|
||||||
for (tags = notmuch_message_get_tags (message);
|
for (tags = notmuch_message_get_tags (message);
|
||||||
notmuch_tags_valid (tags);
|
notmuch_tags_valid (tags);
|
||||||
notmuch_tags_move_to_next (tags))
|
notmuch_tags_move_to_next (tags)) {
|
||||||
{
|
|
||||||
tag = notmuch_tags_get (tags);
|
tag = notmuch_tags_get (tags);
|
||||||
g_hash_table_insert (thread->tags, xstrdup (tag), NULL);
|
g_hash_table_insert (thread->tags, xstrdup (tag), NULL);
|
||||||
}
|
}
|
||||||
|
@ -392,7 +389,8 @@ _thread_add_matched_message (notmuch_thread_t *thread,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
_parent_via_in_reply_to (notmuch_thread_t *thread, notmuch_message_t *message) {
|
_parent_via_in_reply_to (notmuch_thread_t *thread, notmuch_message_t *message)
|
||||||
|
{
|
||||||
notmuch_message_t *parent;
|
notmuch_message_t *parent;
|
||||||
const char *in_reply_to;
|
const char *in_reply_to;
|
||||||
|
|
||||||
|
@ -493,8 +491,7 @@ _resolve_thread_relationships (notmuch_thread_t *thread)
|
||||||
|
|
||||||
for (notmuch_messages_t *messages = _notmuch_messages_create (maybe_toplevel_list);
|
for (notmuch_messages_t *messages = _notmuch_messages_create (maybe_toplevel_list);
|
||||||
notmuch_messages_valid (messages);
|
notmuch_messages_valid (messages);
|
||||||
notmuch_messages_move_to_next (messages))
|
notmuch_messages_move_to_next (messages)) {
|
||||||
{
|
|
||||||
notmuch_message_t *message = notmuch_messages_get (messages);
|
notmuch_message_t *message = notmuch_messages_get (messages);
|
||||||
_notmuch_message_label_depths (message, 0);
|
_notmuch_message_label_depths (message, 0);
|
||||||
}
|
}
|
||||||
|
@ -616,8 +613,7 @@ _notmuch_thread_create (void *ctx,
|
||||||
|
|
||||||
for (;
|
for (;
|
||||||
notmuch_messages_valid (messages);
|
notmuch_messages_valid (messages);
|
||||||
notmuch_messages_move_to_next (messages))
|
notmuch_messages_move_to_next (messages)) {
|
||||||
{
|
|
||||||
unsigned int doc_id;
|
unsigned int doc_id;
|
||||||
|
|
||||||
message = notmuch_messages_get (messages);
|
message = notmuch_messages_get (messages);
|
||||||
|
|
Loading…
Reference in a new issue