cli: run uncrustify

This is the result of running

     $ uncrustify --replace --config devel/uncrustify.cfg *.c *.h

in the top level source directory
This commit is contained in:
uncrustify 2019-06-13 07:31:01 -03:00 committed by David Bremner
parent be8f0ba92a
commit 33382c2b5b
24 changed files with 609 additions and 609 deletions

View file

@ -11,9 +11,9 @@ typedef enum {
} opt_handled;
/*
Search the array of keywords for a given argument, assigning the
output variable to the corresponding value. Return false if nothing
matches.
* Search the array of keywords for a given argument, assigning the
* output variable to the corresponding value. Return false if nothing
* matches.
*/
static opt_handled
@ -84,9 +84,11 @@ _process_boolean_arg (const notmuch_opt_desc_t *arg_desc, char next,
}
static opt_handled
_process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
_process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str)
{
char *endptr;
if (next == '\0' || arg_str[0] == '\0') {
fprintf (stderr, "Option \"%s\" needs an integer argument.\n", arg_desc->name);
return OPT_FAILED;
@ -102,7 +104,8 @@ _process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg
}
static opt_handled
_process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
_process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str)
{
if (next == '\0') {
fprintf (stderr, "Option \"%s\" needs a string argument.\n", arg_desc->name);
@ -117,7 +120,8 @@ _process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *
}
/* Return number of non-NULL opt_* fields in opt_desc. */
static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
static int
_opt_set_count (const notmuch_opt_desc_t *opt_desc)
{
return
(bool) opt_desc->opt_inherit +
@ -130,7 +134,8 @@ static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
}
/* Return true if opt_desc is valid. */
static bool _opt_valid (const notmuch_opt_desc_t *opt_desc)
static bool
_opt_valid (const notmuch_opt_desc_t *opt_desc)
{
int n = _opt_set_count (opt_desc);
@ -142,15 +147,17 @@ static bool _opt_valid (const notmuch_opt_desc_t *opt_desc)
}
/*
Search for the {pos_arg_index}th position argument, return false if
that does not exist.
* Search for the {pos_arg_index}th position argument, return false if
* that does not exist.
*/
bool
parse_position_arg (const char *arg_str, int pos_arg_index,
const notmuch_opt_desc_t *arg_desc) {
const notmuch_opt_desc_t *arg_desc)
{
int pos_arg_counter = 0;
while (_opt_valid (arg_desc)) {
if (arg_desc->opt_position) {
if (pos_arg_counter == pos_arg_index) {
@ -271,7 +278,8 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
/* See command-line-arguments.h for description */
int
parse_arguments (int argc, char **argv,
const notmuch_opt_desc_t *options, int opt_index) {
const notmuch_opt_desc_t *options, int opt_index)
{
int pos_arg_index = 0;
bool more_args = true;

View file

@ -45,19 +45,19 @@ typedef struct notmuch_opt_desc {
/*
This is the main entry point for command line argument parsing.
Parse command line arguments according to structure options,
starting at position opt_index.
All output of parsed values is via pointers in options.
Parsing stops at -- (consumed) or at the (k+1)st argument
not starting with -- (a "positional argument") if options contains
k positional argument descriptors.
Returns the index of first non-parsed argument, or -1 in case of error.
* This is the main entry point for command line argument parsing.
*
* Parse command line arguments according to structure options,
* starting at position opt_index.
*
* All output of parsed values is via pointers in options.
*
* Parsing stops at -- (consumed) or at the (k+1)st argument
* not starting with -- (a "positional argument") if options contains
* k positional argument descriptors.
*
* Returns the index of first non-parsed argument, or -1 in case of error.
*
*/
int
parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index);

View file

@ -39,8 +39,7 @@ debugger_is_active (void)
sprintf (buf, "/proc/%d/exe", getppid ());
if (readlink (buf, buf2, sizeof (buf2)) != -1 &&
strncmp (basename (buf2), "gdb", 3) == 0)
{
strncmp (basename (buf2), "gdb", 3) == 0) {
return true;
}

View file

@ -97,8 +97,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
notmuch_filenames_t *filenames;
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);
fd = open (filename, O_RDONLY);
if (fd != -1)
@ -171,6 +170,7 @@ static void
set_signature_list_destructor (mime_node_t *node)
{
GMimeSignatureList **proxy = talloc (node, GMimeSignatureList *);
if (proxy) {
*proxy = node->sig_list;
talloc_set_destructor (proxy, _signature_list_free);

View file

@ -467,7 +467,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
bool gzip_output);
/* If status is non-zero (i.e. error) print appropriate
messages to stderr.
* messages to stderr.
*/
notmuch_status_t

View file

@ -300,7 +300,7 @@ out:
*
* If is_new_ret is NULL, then a "file not found" message will be
* printed to stderr and NULL will be returned.
*
* If is_new_ret is non-NULL then a default configuration will be
* returned and *is_new_ret will be set to 1 on return so that
* the caller can recognize this case.
@ -338,6 +338,7 @@ notmuch_config_open (void *ctx,
int file_had_crypto_group;
notmuch_config_t *config = talloc_zero (ctx, notmuch_config_t);
if (config == NULL) {
fprintf (stderr, "Out of memory.\n");
return NULL;
@ -793,7 +794,7 @@ _item_split (char *item, char **group, char **key)
}
/* These are more properly called Xapian fields, but the user facing
docs call them prefixes, so make the error message match */
* docs call them prefixes, so make the error message match */
static bool
validate_field_name (const char *str)
{
@ -863,6 +864,7 @@ static bool
_stored_in_db (const char *item)
{
config_key_info_t *info;
info = _config_key_info (item);
return (info && info->in_db);

View file

@ -228,8 +228,7 @@ _entries_resemble_maildir (const char *path, struct dirent **entries, int count)
if (strcmp (entries[i]->d_name, "new") == 0 ||
strcmp (entries[i]->d_name, "cur") == 0 ||
strcmp(entries[i]->d_name, "tmp") == 0)
{
strcmp (entries[i]->d_name, "tmp") == 0) {
found++;
if (found == 3)
return 1;
@ -648,8 +647,7 @@ add_files (notmuch_database_t *notmuch,
/* Check if we've walked past any names in db_files or
* db_subdirs. If so, these have been deleted. */
while (notmuch_filenames_valid (db_files) &&
strcmp (notmuch_filenames_get (db_files), entry->d_name) < 0)
{
strcmp (notmuch_filenames_get (db_files), entry->d_name) < 0) {
char *absolute = talloc_asprintf (state->removed_files,
"%s/%s", path,
notmuch_filenames_get (db_files));
@ -664,12 +662,10 @@ add_files (notmuch_database_t *notmuch,
}
while (notmuch_filenames_valid (db_subdirs) &&
strcmp (notmuch_filenames_get (db_subdirs), entry->d_name) <= 0)
{
strcmp (notmuch_filenames_get (db_subdirs), entry->d_name) <= 0) {
const char *filename = notmuch_filenames_get (db_subdirs);
if (strcmp (filename, entry->d_name) < 0)
{
if (strcmp (filename, entry->d_name) < 0) {
char *absolute = talloc_asprintf (state->removed_directories,
"%s/%s", path, filename);
if (state->debug)
@ -694,8 +690,7 @@ add_files (notmuch_database_t *notmuch,
/* Don't add a file that we've added before. */
if (notmuch_filenames_valid (db_files) &&
strcmp (notmuch_filenames_get (db_files), entry->d_name) == 0)
{
strcmp (notmuch_filenames_get (db_files), entry->d_name) == 0) {
notmuch_filenames_move_to_next (db_files);
continue;
}
@ -738,8 +733,7 @@ add_files (notmuch_database_t *notmuch,
/* Now that we've walked the whole filesystem list, anything left
* over in the database lists has been deleted. */
while (notmuch_filenames_valid (db_files))
{
while (notmuch_filenames_valid (db_files)) {
char *absolute = talloc_asprintf (state->removed_files,
"%s/%s", path,
notmuch_filenames_get (db_files));
@ -752,8 +746,7 @@ add_files (notmuch_database_t *notmuch,
notmuch_filenames_move_to_next (db_files);
}
while (notmuch_filenames_valid (db_subdirs))
{
while (notmuch_filenames_valid (db_subdirs)) {
char *absolute = talloc_asprintf (state->removed_directories,
"%s/%s", path,
notmuch_filenames_get (db_subdirs));
@ -939,6 +932,7 @@ remove_filename (notmuch_database_t *notmuch,
{
notmuch_status_t status;
notmuch_message_t *message;
status = notmuch_database_begin_atomic (notmuch);
if (status)
return status;
@ -981,8 +975,7 @@ _remove_directory (void *ctx,
for (files = notmuch_directory_get_child_files (directory);
notmuch_filenames_valid (files);
notmuch_filenames_move_to_next (files))
{
notmuch_filenames_move_to_next (files)) {
absolute = talloc_asprintf (ctx, "%s/%s", path,
notmuch_filenames_get (files));
status = remove_filename (notmuch, absolute, add_files_state);
@ -993,8 +986,7 @@ _remove_directory (void *ctx,
for (subdirs = notmuch_directory_get_child_directories (directory);
notmuch_filenames_valid (subdirs);
notmuch_filenames_move_to_next (subdirs))
{
notmuch_filenames_move_to_next (subdirs)) {
absolute = talloc_asprintf (ctx, "%s/%s", path,
notmuch_filenames_get (subdirs));
status = _remove_directory (ctx, notmuch, absolute, add_files_state);

View file

@ -263,7 +263,8 @@ reply_to_header_is_redundant (GMimeMessage *message,
return ret;
}
static InternetAddressList *get_sender(GMimeMessage *message)
static InternetAddressList *
get_sender (GMimeMessage *message)
{
InternetAddressList *reply_to_list;
@ -290,17 +291,20 @@ static InternetAddressList *get_sender(GMimeMessage *message)
return g_mime_message_get_from (message);
}
static InternetAddressList *get_to(GMimeMessage *message)
static InternetAddressList *
get_to (GMimeMessage *message)
{
return g_mime_message_get_addresses (message, GMIME_ADDRESS_TYPE_TO);
}
static InternetAddressList *get_cc(GMimeMessage *message)
static InternetAddressList *
get_cc (GMimeMessage *message)
{
return g_mime_message_get_addresses (message, GMIME_ADDRESS_TYPE_CC);
}
static InternetAddressList *get_bcc(GMimeMessage *message)
static InternetAddressList *
get_bcc (GMimeMessage *message)
{
return g_mime_message_get_addresses (message, GMIME_ADDRESS_TYPE_BCC);
}
@ -533,6 +537,7 @@ create_reply_message(void *ctx,
* otherwise.
*/
GMimeMessage *reply = g_mime_message_new (limited ? 0 : 1);
if (reply == NULL) {
fprintf (stderr, "Out of memory\n");
return NULL;
@ -608,7 +613,8 @@ enum {
FORMAT_HEADERS_ONLY,
};
static int do_reply(notmuch_config_t *config,
static int
do_reply (notmuch_config_t *config,
notmuch_query_t *query,
notmuch_show_params_t *params,
int format,
@ -645,8 +651,7 @@ static int do_reply(notmuch_config_t *config,
for (;
notmuch_messages_valid (messages);
notmuch_messages_move_to_next (messages))
{
notmuch_messages_move_to_next (messages)) {
message = notmuch_messages_get (messages);
if (mime_node_open (config, message, &params->crypto, &node))

View file

@ -59,7 +59,6 @@ process_config_line (notmuch_database_t *notmuch, const char* line)
static int
process_properties_line (notmuch_database_t *notmuch, const char *line)
{
const char *id_p, *tok;
size_t id_len = 0, tok_len = 0;

View file

@ -87,8 +87,7 @@ get_thread_query (notmuch_thread_t *thread,
for (messages = notmuch_thread_get_messages (thread);
notmuch_messages_valid (messages);
notmuch_messages_move_to_next (messages))
{
notmuch_messages_move_to_next (messages)) {
notmuch_message_t *message = notmuch_messages_get (messages);
const char *mid = notmuch_message_get_message_id (message);
/* Determine which query buffer to extend */
@ -141,8 +140,7 @@ do_search_threads (search_context_t *ctx)
for (i = 0;
notmuch_threads_valid (threads) && (ctx->limit < 0 || i < ctx->offset + ctx->limit);
notmuch_threads_move_to_next (threads), i++)
{
notmuch_threads_move_to_next (threads), i++) {
thread = notmuch_threads_get (threads);
if (i < ctx->offset) {
@ -237,8 +235,7 @@ do_search_threads (search_context_t *ctx)
for (tags = notmuch_thread_get_tags (thread);
notmuch_tags_valid (tags);
notmuch_tags_move_to_next (tags))
{
notmuch_tags_move_to_next (tags)) {
const char *tag = notmuch_tags_get (tags);
if (format->is_text_printer) {
@ -269,7 +266,8 @@ do_search_threads (search_context_t *ctx)
return 0;
}
static mailbox_t *new_mailbox (void *ctx, const char *name, const char *addr)
static mailbox_t *
new_mailbox (void *ctx, const char *name, const char *addr)
{
mailbox_t *mailbox;
@ -284,7 +282,8 @@ static mailbox_t *new_mailbox (void *ctx, const char *name, const char *addr)
return mailbox;
}
static int mailbox_compare (const void *v1, const void *v2)
static int
mailbox_compare (const void *v1, const void *v2)
{
const mailbox_t *m1 = v1, *m2 = v2;
int ret;
@ -561,8 +560,7 @@ do_search_messages (search_context_t *ctx)
for (i = 0;
notmuch_messages_valid (messages) && (ctx->limit < 0 || i < ctx->offset + ctx->limit);
notmuch_messages_move_to_next (messages), i++)
{
notmuch_messages_move_to_next (messages), i++) {
if (i < ctx->offset)
continue;
@ -574,8 +572,7 @@ do_search_messages (search_context_t *ctx)
for (j = 1;
notmuch_filenames_valid (filenames);
notmuch_filenames_move_to_next (filenames), j++)
{
notmuch_filenames_move_to_next (filenames), j++) {
if (ctx->dupe < 0 || ctx->dupe == j) {
format->string (format, notmuch_filenames_get (filenames));
format->separator (format);
@ -657,8 +654,7 @@ do_search_tags (const search_context_t *ctx)
for (;
notmuch_tags_valid (tags);
notmuch_tags_move_to_next (tags))
{
notmuch_tags_move_to_next (tags)) {
tag = notmuch_tags_get (tags);
format->string (format, tag);

View file

@ -91,6 +91,7 @@ static void
print_tag_list (const char **tags, size_t tags_len)
{
unsigned int i;
for (i = 0; i < tags_len; i++) {
if (i != 0)
printf (" ");

View file

@ -37,8 +37,7 @@ _get_tags_as_string (const void *ctx, 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);
result = talloc_asprintf_append (result, "%s%s",
@ -69,7 +68,8 @@ _get_one_line_summary (const void *ctx, notmuch_message_t *message)
from, relative_date, tags);
}
static const char *_get_disposition(GMimeObject *meta)
static const char *
_get_disposition (GMimeObject *meta)
{
GMimeContentDisposition *disposition;
@ -373,7 +373,8 @@ struct key_map_struct {
static void
do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
unsigned int array_map_len, GMimeSignatureStatus errors) {
unsigned int array_map_len, GMimeSignatureStatus errors)
{
sp->map_key (sp, "errors");
sp->begin_map (sp);
@ -555,8 +556,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
g_mime_stream_printf (stream, "Date: %s\n", date_string);
g_mime_stream_printf (stream, "\fheader}\n");
if (!params->output_body)
{
if (! params->output_body) {
g_mime_stream_printf (stream, "\f%s}\n", part_type);
return NOTMUCH_STATUS_SUCCESS;
}
@ -566,8 +566,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
if (leaf) {
if (g_mime_content_type_is_type (content_type, "text", "*") &&
(params->include_html ||
! g_mime_content_type_is_type (content_type, "text", "html")))
{
! g_mime_content_type_is_type (content_type, "text", "html"))) {
show_text_part_content (node->part, stream, 0);
} else {
char *content_string = g_mime_content_type_get_mime_type (content_type);
@ -751,8 +750,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
*/
if (g_mime_content_type_is_type (content_type, "text", "*") &&
(include_html ||
! g_mime_content_type_is_type (content_type, "text", "html")))
{
! g_mime_content_type_is_type (content_type, "text", "html"))) {
GMimeStream *stream_memory = g_mime_stream_mem_new ();
GByteArray *part_content;
show_text_part_content (node->part, stream_memory, 0);
@ -990,8 +988,7 @@ show_messages (void *ctx,
for (;
notmuch_messages_valid (messages);
notmuch_messages_move_to_next (messages))
{
notmuch_messages_move_to_next (messages)) {
sp->begin_list (sp);
message = notmuch_messages_get (messages);
@ -1088,8 +1085,7 @@ do_show (void *ctx,
for (;
notmuch_threads_valid (threads);
notmuch_threads_move_to_next (threads))
{
notmuch_threads_move_to_next (threads)) {
thread = notmuch_threads_get (threads);
messages = notmuch_thread_get_toplevel_messages (thread);

View file

@ -76,8 +76,7 @@ notmuch_time_relative_date (const void *ctx, time_t then)
if (delta <= 7 * DAY) {
if (tm_then.tm_wday == tm_now.tm_wday &&
delta < DAY)
{
delta < DAY) {
strftime (result, RELATIVE_DATE_MAX,
"Today %R", &tm_then); /* Today 12:30 */
return result;

View file

@ -61,7 +61,8 @@ const notmuch_opt_desc_t notmuch_shared_options [] = {
* notmuch_process_shared_options (subcommand_name);
*/
void
notmuch_process_shared_options (const char *subcommand_name) {
notmuch_process_shared_options (const char *subcommand_name)
{
if (print_version) {
printf ("notmuch " STRINGIFY (NOTMUCH_VERSION) "\n");
exit (EXIT_SUCCESS);
@ -76,7 +77,8 @@ notmuch_process_shared_options (const char *subcommand_name) {
/* This is suitable for subcommands that do not actually open the
* database.
*/
int notmuch_minimal_options (const char *subcommand_name,
int
notmuch_minimal_options (const char *subcommand_name,
int argc, char **argv)
{
int opt_index;
@ -417,7 +419,8 @@ notmuch_command (notmuch_config_t *config,
* executed. Return true if external command is not found. Return
* false on errors.
*/
static bool try_external_command(char *argv[])
static bool
try_external_command (char *argv[])
{
char *old_argv0 = argv[0];
bool ret = true;