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:
uncrustify 2019-06-13 07:55:35 -03:00 committed by David Bremner
parent 8a3f86f2f9
commit 2b62ca2e3b
24 changed files with 513 additions and 513 deletions

View file

@ -1182,7 +1182,9 @@ class NotmuchCompactor : public Xapian::Compactor
public:
NotmuchCompactor(notmuch_compact_status_cb_t cb, void *closure) :
status_cb (cb), status_closure (closure) { }
status_cb (cb), status_closure (closure)
{
}
virtual void
set_status (const std::string &table, const std::string &status)
@ -1265,8 +1267,7 @@ notmuch_database_compact (const char *path,
goto DONE;
}
keep_backup = false;
}
else {
} else {
keep_backup = true;
}
@ -1510,8 +1511,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
goto DONE;
for (;
notmuch_messages_valid (messages);
notmuch_messages_move_to_next (messages))
{
notmuch_messages_move_to_next (messages)) {
if (do_progress_notify) {
progress_notify (closure, (double) count / total);
do_progress_notify = 0;
@ -1568,8 +1568,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
for (t = notmuch->xapian_db->allterms_begin ("XTIMESTAMP");
t != t_end;
t++)
{
t++) {
Xapian::PostingIterator p, p_end;
std::string term = *t;
@ -1577,8 +1576,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
for (p = notmuch->xapian_db->postlist_begin (term);
p != p_end;
p++)
{
p++) {
Xapian::Document document;
time_t mtime;
notmuch_directory_t *directory;
@ -1953,8 +1951,7 @@ _notmuch_database_relative_path (notmuch_database_t *notmuch,
while (*relative == '/' && *(relative + 1) == '/')
relative++;
if (strncmp (relative, db_path, db_path_len) == 0)
{
if (strncmp (relative, db_path, db_path_len) == 0) {
relative += db_path_len;
while (*relative == '/')
relative++;

View file

@ -59,21 +59,21 @@ static const scanner_state_t uuencode_states[] = {
};
/* The following table is intended to implement this DFA (in 'dot'
format). Note that 2 and 3 are "hidden" states used to step through
the possible out edges of state 1.
digraph html_filter {
0 -> 1 [label="<"];
0 -> 0;
1 -> 4 [label="'"];
1 -> 5 [label="\""];
1 -> 0 [label=">"];
1 -> 1;
4 -> 1 [label="'"];
4 -> 4;
5 -> 1 [label="\""];
5 -> 5;
}
* format). Note that 2 and 3 are "hidden" states used to step through
* the possible out edges of state 1.
*
* digraph html_filter {
* 0 -> 1 [label="<"];
* 0 -> 0;
* 1 -> 4 [label="'"];
* 1 -> 5 [label="\""];
* 1 -> 0 [label=">"];
* 1 -> 1;
* 4 -> 1 [label="'"];
* 4 -> 4;
* 5 -> 1 [label="\""];
* 5 -> 5;
* }
*/
static const int first_html_skipping_state = 1;
static const scanner_state_t html_states[] = {
@ -168,6 +168,7 @@ static GMimeFilter *
filter_copy (GMimeFilter *gmime_filter)
{
NotmuchFilterDiscardNonTerm *filter = (NotmuchFilterDiscardNonTerm *) gmime_filter;
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)
{
GMimeContentType *content_type = g_mime_object_get_content_type (part);
if (content_type) {
char *mime_string = g_mime_content_type_get_mime_type (content_type);
if (mime_string) {
@ -464,8 +466,7 @@ _index_mime_part (notmuch_message_t *message,
disposition = g_mime_object_get_content_disposition (part);
if (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));
_notmuch_message_add_term (message, "tag", "attachment");

View file

@ -24,6 +24,7 @@ notmuch_indexopts_t *
notmuch_database_get_default_indexopts (notmuch_database_t *db)
{
notmuch_indexopts_t *ret = talloc_zero (db, notmuch_indexopts_t);
if (! ret)
return ret;
ret->crypto.decrypt = NOTMUCH_DECRYPT_AUTO;

View file

@ -201,7 +201,8 @@ _notmuch_message_file_get_mime_message (notmuch_message_file_t *message,
*/
static char *
_extend_header (char *combined, const char *value) {
_extend_header (char *combined, const char *value)
{
char *decoded;
decoded = g_mime_utils_header_decode_text (NULL, value);

View file

@ -150,6 +150,7 @@ notmuch_message_properties_t *
notmuch_message_get_properties (notmuch_message_t *message, const char *key, notmuch_bool_t exact)
{
notmuch_string_map_t *map;
map = _notmuch_message_property_map (message);
return _notmuch_string_map_iterator_create (map, key, exact);
}

View file

@ -604,7 +604,8 @@ _notmuch_message_add_reply (notmuch_message_t *message,
}
size_t
_notmuch_message_get_thread_depth (notmuch_message_t *message) {
_notmuch_message_get_thread_depth (notmuch_message_t *message)
{
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". */
static bool is_maildir (const char *p)
static bool
is_maildir (const char *p)
{
return strcmp (p, "cur") == 0 || strcmp (p, "new") == 0;
}
@ -1108,8 +1110,7 @@ notmuch_message_get_filename (notmuch_message_t *message)
return 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");
}
@ -1339,8 +1340,8 @@ _notmuch_message_delete (notmuch_message_t *message)
_notmuch_message_sync (ghost);
} else if (private_status == NOTMUCH_PRIVATE_STATUS_SUCCESS) {
/* this is deeply weird, and we should not have gotten
into this state. is there a better error message to
return here? */
* into this state. is there a better error message to
* return here? */
status = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
}
@ -1635,8 +1636,7 @@ _filename_is_in_maildir (const char *filename)
dir = slash + 1;
if (STRNCMP_LITERAL (dir, "cur/") == 0 ||
STRNCMP_LITERAL (dir, "new/") == 0)
{
STRNCMP_LITERAL (dir, "new/") == 0) {
return dir;
}
@ -1661,8 +1661,7 @@ _ensure_maildir_flags (notmuch_message_t *message, bool force)
for (filenames = notmuch_message_get_filenames (message);
notmuch_filenames_valid (filenames);
notmuch_filenames_move_to_next (filenames))
{
notmuch_filenames_move_to_next (filenames)) {
filename = notmuch_filenames_get (filenames);
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++) {
if ((strchr (message->maildir_flags, flag2tag[i].flag) != NULL)
^
flag2tag[i].inverse)
{
flag2tag[i].inverse) {
status = notmuch_message_add_tag (message, flag2tag[i].tag);
} else {
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. */
for (tags = notmuch_message_get_tags (message);
notmuch_tags_valid (tags);
notmuch_tags_move_to_next (tags))
{
notmuch_tags_move_to_next (tags)) {
tag = notmuch_tags_get (tags);
for (i = 0; i < ARRAY_SIZE (flag2tag); i++) {
@ -1827,8 +1824,7 @@ _new_maildir_filename (void *ctx,
/* Loop through existing flags in filename. */
for (flags = info + 3, last_flag = 0;
*flags;
last_flag = flag, flags++)
{
last_flag = flag, flags++) {
flag = *flags;
/* Original flags not in ASCII order. Abort. */
@ -1885,8 +1881,7 @@ _new_maildir_filename (void *ctx,
strcat (filename_new, ":2,");
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]) {
*s = i;
s++;
@ -1915,8 +1910,7 @@ notmuch_message_tags_to_maildir_flags (notmuch_message_t *message)
for (filenames = notmuch_message_get_filenames (message);
notmuch_filenames_valid (filenames);
notmuch_filenames_move_to_next (filenames))
{
notmuch_filenames_move_to_next (filenames)) {
filename = notmuch_filenames_get (filenames);
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);
notmuch_tags_valid (tags);
notmuch_tags_move_to_next (tags))
{
notmuch_tags_move_to_next (tags)) {
tag = notmuch_tags_get (tags);
private_status = _notmuch_message_remove_term (message, "tag", tag);

View file

@ -83,7 +83,7 @@ NOTMUCH_BEGIN_DECLS
/* these macros gain us a few percent of speed on gcc */
#if (__GNUC__ >= 3)
/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1
as its first argument */
* as its first argument */
#ifndef likely
#define likely(x) __builtin_expect (! ! (x), 1)
#endif

View file

@ -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
* of *count is not defined
*
* NOTMUCH_STATUS_SUCCESS: query completed successfully.
*
* NOTMUCH_STATUS_XAPIAN_EXCEPTION: a Xapian exception occurred. The

View file

@ -67,7 +67,9 @@ ParseTimeValueRangeProcessor::operator() (std::string &begin, std::string &end)
#if HAVE_XAPIAN_FIELD_PROCESSOR
/* 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;
/* Use the same 'now' for begin and end. */

View file

@ -32,7 +32,9 @@ protected:
public:
ParseTimeValueRangeProcessor (Xapian::valueno slot_)
: valno(slot_) { }
: valno (slot_)
{
}
Xapian::valueno operator() (std::string &begin, std::string &end);
};

View file

@ -34,7 +34,9 @@ class QueryFieldProcessor : public Xapian::FieldProcessor {
public:
QueryFieldProcessor (Xapian::QueryParser &parser_, notmuch_database_t *notmuch_)
: parser(parser_), notmuch(notmuch_) { };
: parser (parser_), notmuch (notmuch_)
{
};
Xapian::Query operator() (const std::string & str);
};

View file

@ -71,12 +71,14 @@ static bool
_debug_query (void)
{
char *env = getenv ("NOTMUCH_DEBUG_QUERY");
return (env && strcmp (env, "") != 0);
}
/* Explicit destructor call for placement new */
static int
_notmuch_query_destructor (notmuch_query_t *query) {
_notmuch_query_destructor (notmuch_query_t *query)
{
query->xapian_query.~Query();
query->terms.~set<std::string>();
return 0;
@ -278,8 +280,7 @@ _notmuch_query_search_documents (notmuch_query_t *query,
Xapian::MSetIterator iterator;
if (strcmp (query_string, "") == 0 ||
strcmp (query_string, "*") == 0)
{
strcmp (query_string, "*") == 0) {
final_query = mail_query;
} else {
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);
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, exclude_query);
} else { /* NOTMUCH_EXCLUDE_FLAG */
@ -408,8 +408,7 @@ _notmuch_mset_messages_get (notmuch_messages_t *messages)
&status);
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");
}
@ -624,8 +623,7 @@ _notmuch_query_count_documents (notmuch_query_t *query, const char *type, unsign
Xapian::MSet mset;
if (strcmp (query_string, "") == 0 ||
strcmp (query_string, "*") == 0)
{
strcmp (query_string, "*") == 0) {
final_query = mail_query;
} else {
final_query = Xapian::Query (Xapian::Query::OP_AND,

View file

@ -129,7 +129,8 @@ RegexpPostingSource::check (Xapian::docid did, unused (double min_wt))
return (regexec (&regexp_, (*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")
return NOTMUCH_VALUE_FROM;

View file

@ -73,7 +73,9 @@ class RegexpFieldProcessor : public Xapian::FieldProcessor {
RegexpFieldProcessor (std::string prefix, notmuch_field_flag_t options,
Xapian::QueryParser &parser_, notmuch_database_t *notmuch_);
~RegexpFieldProcessor () { };
~RegexpFieldProcessor ()
{
};
Xapian::Query operator() (const std::string & str);
};

View file

@ -55,6 +55,7 @@ char *
_notmuch_sha1_of_file (const char *filename)
{
FILE *file;
#define BLOCK_SIZE 4096
unsigned char block[BLOCK_SIZE];
size_t bytes_read;

View file

@ -34,7 +34,9 @@ class ThreadFieldProcessor : public Xapian::FieldProcessor {
public:
ThreadFieldProcessor (Xapian::QueryParser &parser_, notmuch_database_t *notmuch_)
: parser(parser_), notmuch(notmuch_) { };
: parser (parser_), notmuch (notmuch_)
{
};
Xapian::Query operator() (const std::string & str);
};

View file

@ -251,14 +251,12 @@ _thread_add_message (notmuch_thread_t *thread,
if (omit_exclude != NOTMUCH_EXCLUDE_FALSE) {
for (tags = notmuch_message_get_tags (message);
notmuch_tags_valid (tags);
notmuch_tags_move_to_next (tags))
{
notmuch_tags_move_to_next (tags)) {
tag = notmuch_tags_get (tags);
/* Is message excluded? */
for (notmuch_string_node_t *term = exclude_terms->head;
term != NULL;
term = term->next)
{
term = term->next) {
/* Check for an empty string, and then ignore initial 'K'. */
if (*(term->string) && strcmp (tag, (term->string + 1)) == 0) {
message_excluded = true;
@ -309,8 +307,7 @@ _thread_add_message (notmuch_thread_t *thread,
for (tags = notmuch_message_get_tags (message);
notmuch_tags_valid (tags);
notmuch_tags_move_to_next (tags))
{
notmuch_tags_move_to_next (tags)) {
tag = notmuch_tags_get (tags);
g_hash_table_insert (thread->tags, xstrdup (tag), NULL);
}
@ -392,7 +389,8 @@ _thread_add_matched_message (notmuch_thread_t *thread,
}
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;
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);
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_label_depths (message, 0);
}
@ -616,8 +613,7 @@ _notmuch_thread_create (void *ctx,
for (;
notmuch_messages_valid (messages);
notmuch_messages_move_to_next (messages))
{
notmuch_messages_move_to_next (messages)) {
unsigned int doc_id;
message = notmuch_messages_get (messages);