summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--command-line-arguments.c56
-rw-r--r--command-line-arguments.h32
-rw-r--r--debugger.c3
-rw-r--r--gmime-filter-reply.c190
-rw-r--r--gmime-filter-reply.h10
-rw-r--r--hooks.c4
-rw-r--r--mime-node.c26
-rw-r--r--notmuch-client.h60
-rw-r--r--notmuch-config.c120
-rw-r--r--notmuch-count.c10
-rw-r--r--notmuch-dump.c20
-rw-r--r--notmuch-insert.c10
-rw-r--r--notmuch-new.c86
-rw-r--r--notmuch-reindex.c8
-rw-r--r--notmuch-reply.c93
-rw-r--r--notmuch-restore.c39
-rw-r--r--notmuch-search.c144
-rw-r--r--notmuch-setup.c87
-rw-r--r--notmuch-show.c128
-rw-r--r--notmuch-time.c17
-rw-r--r--notmuch.c49
-rw-r--r--sprinter.h22
-rw-r--r--status.c4
-rw-r--r--tag-util.h18
24 files changed, 618 insertions, 618 deletions
diff --git a/command-line-arguments.c b/command-line-arguments.c
index 6699c521..169b12a3 100644
--- a/command-line-arguments.c
+++ b/command-line-arguments.c
@@ -5,16 +5,16 @@
#include "command-line-arguments.h"
typedef enum {
- OPT_FAILED, /* false */
- OPT_OK, /* good */
- OPT_GIVEBACK, /* pop one of the arguments you thought you were getting off the stack */
+ OPT_FAILED, /* false */
+ OPT_OK, /* good */
+ OPT_GIVEBACK, /* pop one of the arguments you thought you were getting off the stack */
} 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
_process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next,
@@ -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) {
@@ -176,12 +183,12 @@ parse_position_arg (const char *arg_str, int pos_arg_index,
int
parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index)
{
- assert(argv);
+ assert (argv);
const char *_arg = argv[opt_index];
- assert(_arg);
- assert(options);
+ assert (_arg);
+ assert (options);
const char *arg = _arg + 2; /* _arg starts with -- */
const char *negative_arg = NULL;
@@ -239,7 +246,7 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
if (lookahead) {
next = ' ';
value = next_arg;
- opt_index ++;
+ opt_index++;
}
opt_handled opt_status = OPT_FAILED;
@@ -258,12 +265,12 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
return -1;
if (lookahead && opt_status == OPT_GIVEBACK)
- opt_index --;
+ opt_index--;
if (try->present)
*try->present = true;
- return opt_index+1;
+ return opt_index + 1;
}
return -1;
}
@@ -271,13 +278,14 @@ 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;
while (more_args && opt_index < argc) {
- if (strncmp (argv[opt_index],"--",2) != 0) {
+ if (strncmp (argv[opt_index], "--", 2) != 0) {
more_args = parse_position_arg (argv[opt_index], pos_arg_index, options);
@@ -290,7 +298,7 @@ parse_arguments (int argc, char **argv,
int prev_opt_index = opt_index;
if (strlen (argv[opt_index]) == 2)
- return opt_index+1;
+ return opt_index + 1;
opt_index = parse_option (argc, argv, options, opt_index);
if (opt_index < 0) {
diff --git a/command-line-arguments.h b/command-line-arguments.h
index f722f97d..606e5cd0 100644
--- a/command-line-arguments.h
+++ b/command-line-arguments.h
@@ -45,20 +45,20 @@ 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);
@@ -71,12 +71,12 @@ parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int o
*/
int
-parse_option (int argc, char **argv, const notmuch_opt_desc_t* options, int opt_index);
+parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index);
bool
parse_position_arg (const char *arg,
int position_arg_index,
- const notmuch_opt_desc_t* options);
+ const notmuch_opt_desc_t *options);
#endif
diff --git a/debugger.c b/debugger.c
index 0febf170..5f47a1d7 100644
--- a/debugger.c
+++ b/debugger.c
@@ -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;
}
diff --git a/gmime-filter-reply.c b/gmime-filter-reply.c
index 480d9381..2b067669 100644
--- a/gmime-filter-reply.c
+++ b/gmime-filter-reply.c
@@ -47,143 +47,143 @@ static GMimeFilterClass *parent_class = NULL;
GType
g_mime_filter_reply_get_type (void)
{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- .class_size = sizeof (GMimeFilterReplyClass),
- .base_init = NULL,
- .base_finalize = NULL,
- .class_init = (GClassInitFunc) g_mime_filter_reply_class_init,
- .class_finalize = NULL,
- .class_data = NULL,
- .instance_size = sizeof (GMimeFilterReply),
- .n_preallocs = 0,
- .instance_init = (GInstanceInitFunc) g_mime_filter_reply_init,
- .value_table = NULL,
- };
-
- type = g_type_register_static (GMIME_TYPE_FILTER, "GMimeFilterReply", &info, (GTypeFlags) 0);
- }
-
- return type;
+ static GType type = 0;
+
+ if (! type) {
+ static const GTypeInfo info = {
+ .class_size = sizeof (GMimeFilterReplyClass),
+ .base_init = NULL,
+ .base_finalize = NULL,
+ .class_init = (GClassInitFunc) g_mime_filter_reply_class_init,
+ .class_finalize = NULL,
+ .class_data = NULL,
+ .instance_size = sizeof (GMimeFilterReply),
+ .n_preallocs = 0,
+ .instance_init = (GInstanceInitFunc) g_mime_filter_reply_init,
+ .value_table = NULL,
+ };
+
+ type = g_type_register_static (GMIME_TYPE_FILTER, "GMimeFilterReply", &info, (GTypeFlags) 0);
+ }
+
+ return type;
}
static void
g_mime_filter_reply_class_init (GMimeFilterReplyClass *klass, unused (void *class_data))
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GMimeFilterClass *filter_class = GMIME_FILTER_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GMimeFilterClass *filter_class = GMIME_FILTER_CLASS (klass);
- parent_class = (GMimeFilterClass *) g_type_class_ref (GMIME_TYPE_FILTER);
+ parent_class = (GMimeFilterClass *) g_type_class_ref (GMIME_TYPE_FILTER);
- object_class->finalize = g_mime_filter_reply_finalize;
+ object_class->finalize = g_mime_filter_reply_finalize;
- filter_class->copy = filter_copy;
- filter_class->filter = filter_filter;
- filter_class->complete = filter_complete;
- filter_class->reset = filter_reset;
+ filter_class->copy = filter_copy;
+ filter_class->filter = filter_filter;
+ filter_class->complete = filter_complete;
+ filter_class->reset = filter_reset;
}
static void
g_mime_filter_reply_init (GMimeFilterReply *filter, GMimeFilterReplyClass *klass)
{
- (void) klass;
- filter->saw_nl = true;
- filter->saw_angle = false;
+ (void) klass;
+ filter->saw_nl = true;
+ filter->saw_angle = false;
}
static void
g_mime_filter_reply_finalize (GObject *object)
{
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GMimeFilter *
filter_copy (GMimeFilter *filter)
{
- GMimeFilterReply *reply = (GMimeFilterReply *) filter;
+ GMimeFilterReply *reply = (GMimeFilterReply *) filter;
- return g_mime_filter_reply_new (reply->encode);
+ return g_mime_filter_reply_new (reply->encode);
}
static void
filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
char **outbuf, size_t *outlen, size_t *outprespace)
{
- GMimeFilterReply *reply = (GMimeFilterReply *) filter;
- const char *inptr = inbuf;
- const char *inend = inbuf + inlen;
- char *outptr;
-
- (void) prespace;
- if (reply->encode) {
- g_mime_filter_set_size (filter, 3 * inlen, false);
-
- outptr = filter->outbuf;
- while (inptr < inend) {
- if (reply->saw_nl) {
- *outptr++ = '>';
- *outptr++ = ' ';
- reply->saw_nl = false;
- }
- if (*inptr == '\n')
- reply->saw_nl = true;
- else
- reply->saw_nl = false;
- if (*inptr != '\r')
- *outptr++ = *inptr;
- inptr++;
- }
- } else {
- g_mime_filter_set_size (filter, inlen + 1, false);
-
- outptr = filter->outbuf;
- while (inptr < inend) {
- if (reply->saw_nl) {
- if (*inptr == '>')
- reply->saw_angle = true;
- else
- *outptr++ = *inptr;
- reply->saw_nl = false;
- } else if (reply->saw_angle) {
- if (*inptr == ' ')
- ;
- else
- *outptr++ = *inptr;
- reply->saw_angle = false;
- } else if (*inptr != '\r') {
- if (*inptr == '\n')
- reply->saw_nl = true;
- *outptr++ = *inptr;
- }
-
- inptr++;
- }
+ GMimeFilterReply *reply = (GMimeFilterReply *) filter;
+ const char *inptr = inbuf;
+ const char *inend = inbuf + inlen;
+ char *outptr;
+
+ (void) prespace;
+ if (reply->encode) {
+ g_mime_filter_set_size (filter, 3 * inlen, false);
+
+ outptr = filter->outbuf;
+ while (inptr < inend) {
+ if (reply->saw_nl) {
+ *outptr++ = '>';
+ *outptr++ = ' ';
+ reply->saw_nl = false;
+ }
+ if (*inptr == '\n')
+ reply->saw_nl = true;
+ else
+ reply->saw_nl = false;
+ if (*inptr != '\r')
+ *outptr++ = *inptr;
+ inptr++;
+ }
+ } else {
+ g_mime_filter_set_size (filter, inlen + 1, false);
+
+ outptr = filter->outbuf;
+ while (inptr < inend) {
+ if (reply->saw_nl) {
+ if (*inptr == '>')
+ reply->saw_angle = true;
+ else
+ *outptr++ = *inptr;
+ reply->saw_nl = false;
+ } else if (reply->saw_angle) {
+ if (*inptr == ' ')
+ ;
+ else
+ *outptr++ = *inptr;
+ reply->saw_angle = false;
+ } else if (*inptr != '\r') {
+ if (*inptr == '\n')
+ reply->saw_nl = true;
+ *outptr++ = *inptr;
+ }
+
+ inptr++;
}
+ }
- *outlen = outptr - filter->outbuf;
- *outprespace = filter->outpre;
- *outbuf = filter->outbuf;
+ *outlen = outptr - filter->outbuf;
+ *outprespace = filter->outpre;
+ *outbuf = filter->outbuf;
}
static void
filter_complete (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
char **outbuf, size_t *outlen, size_t *outprespace)
{
- if (inbuf && inlen)
- filter_filter (filter, inbuf, inlen, prespace, outbuf, outlen, outprespace);
+ if (inbuf && inlen)
+ filter_filter (filter, inbuf, inlen, prespace, outbuf, outlen, outprespace);
}
static void
filter_reset (GMimeFilter *filter)
{
- GMimeFilterReply *reply = (GMimeFilterReply *) filter;
+ GMimeFilterReply *reply = (GMimeFilterReply *) filter;
- reply->saw_nl = true;
- reply->saw_angle = false;
+ reply->saw_nl = true;
+ reply->saw_angle = false;
}
@@ -202,11 +202,11 @@ filter_reset (GMimeFilter *filter)
GMimeFilter *
g_mime_filter_reply_new (gboolean encode)
{
- GMimeFilterReply *new_reply;
+ GMimeFilterReply *new_reply;
- new_reply = (GMimeFilterReply *) g_object_new (GMIME_TYPE_FILTER_REPLY, NULL);
- new_reply->encode = encode;
+ new_reply = (GMimeFilterReply *) g_object_new (GMIME_TYPE_FILTER_REPLY, NULL);
+ new_reply->encode = encode;
- return (GMimeFilter *) new_reply;
+ return (GMimeFilter *) new_reply;
}
diff --git a/gmime-filter-reply.h b/gmime-filter-reply.h
index b7cbc6b1..5a1e606e 100644
--- a/gmime-filter-reply.h
+++ b/gmime-filter-reply.h
@@ -43,15 +43,15 @@ typedef struct _GMimeFilterReplyClass GMimeFilterReplyClass;
* A filter to insert/remove reply markers (lines beginning with >)
**/
struct _GMimeFilterReply {
- GMimeFilter parent_object;
+ GMimeFilter parent_object;
- gboolean encode;
- gboolean saw_nl;
- gboolean saw_angle;
+ gboolean encode;
+ gboolean saw_nl;
+ gboolean saw_angle;
};
struct _GMimeFilterReplyClass {
- GMimeFilterClass parent_class;
+ GMimeFilterClass parent_class;
};
diff --git a/hooks.c b/hooks.c
index 7348d322..59c58070 100644
--- a/hooks.c
+++ b/hooks.c
@@ -53,7 +53,7 @@ notmuch_run_hook (const char *db_path, const char *hook)
/* Flush any buffered output before forking. */
fflush (stdout);
- pid = fork();
+ pid = fork ();
if (pid == -1) {
fprintf (stderr, "Error: %s hook fork failed: %s\n", hook,
strerror (errno));
@@ -78,7 +78,7 @@ notmuch_run_hook (const char *db_path, const char *hook)
goto DONE;
}
- if (!WIFEXITED (status) || WEXITSTATUS (status)) {
+ if (! WIFEXITED (status) || WEXITSTATUS (status)) {
if (WIFEXITED (status)) {
fprintf (stderr, "Error: %s hook failed with status %d\n",
hook, WEXITSTATUS (status));
diff --git a/mime-node.c b/mime-node.c
index 4ca51fe9..3133ca44 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -55,7 +55,7 @@ _mime_node_context_free (mime_node_context_t *res)
return 0;
}
-const _notmuch_message_crypto_t*
+const _notmuch_message_crypto_t *
mime_node_get_message_crypto_status (mime_node_t *node)
{
return node->ctx->msg_crypto;
@@ -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)
@@ -109,27 +108,27 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
if (fd == -1) {
/* Give up */
fprintf (stderr, "Error opening %s: %s\n", filename, strerror (errno));
- status = NOTMUCH_STATUS_FILE_ERROR;
- goto DONE;
- }
+ status = NOTMUCH_STATUS_FILE_ERROR;
+ goto DONE;
}
+ }
mctx->stream = g_mime_stream_gzfile_new (fd);
- if (!mctx->stream) {
+ if (! mctx->stream) {
fprintf (stderr, "Out of memory.\n");
status = NOTMUCH_STATUS_OUT_OF_MEMORY;
goto DONE;
}
mctx->parser = g_mime_parser_new_with_stream (mctx->stream);
- if (!mctx->parser) {
+ if (! mctx->parser) {
fprintf (stderr, "Out of memory.\n");
status = NOTMUCH_STATUS_OUT_OF_MEMORY;
goto DONE;
}
mctx->mime_message = g_mime_parser_construct_message (mctx->parser, NULL);
- if (!mctx->mime_message) {
+ if (! mctx->mime_message) {
fprintf (stderr, "Failed to parse %s\n", filename);
status = NOTMUCH_STATUS_FILE_ERROR;
goto DONE;
@@ -153,7 +152,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
*root_out = root;
return NOTMUCH_STATUS_SUCCESS;
-DONE:
+ DONE:
talloc_free (root);
return status;
}
@@ -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);
@@ -259,7 +259,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
g_object_unref (decrypt_result);
}
- DONE:
+ DONE:
if (err)
g_error_free (err);
}
@@ -273,7 +273,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part, int numchild)
/* Set basic node properties */
node->part = part;
node->ctx = parent->ctx;
- if (!talloc_reference (node, node->ctx)) {
+ if (! talloc_reference (node, node->ctx)) {
fprintf (stderr, "Out of memory.\n");
talloc_free (node);
return NULL;
@@ -335,7 +335,7 @@ mime_node_child (mime_node_t *parent, int child)
GMimeObject *sub;
mime_node_t *node;
- if (!parent || !parent->part || child < 0 || child >= parent->nchildren)
+ if (! parent || ! parent->part || child < 0 || child >= parent->nchildren)
return NULL;
if (GMIME_IS_MULTIPART (parent->part)) {
diff --git a/notmuch-client.h b/notmuch-client.h
index b3a501a9..d1b78017 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -55,7 +55,7 @@
#define unused(x) x ## _unused __attribute__ ((unused))
-#define STRINGIFY(s) STRINGIFY_(s)
+#define STRINGIFY(s) STRINGIFY_ (s)
#define STRINGIFY_(s) #s
typedef struct mime_node mime_node_t;
@@ -63,10 +63,10 @@ struct sprinter;
struct notmuch_show_params;
typedef struct notmuch_show_format {
- struct sprinter *(*new_sprinter) (const void *ctx, FILE *stream);
- notmuch_status_t (*part) (const void *ctx, struct sprinter *sprinter,
- struct mime_node *node, int indent,
- const struct notmuch_show_params *params);
+ struct sprinter *(*new_sprinter)(const void *ctx, FILE *stream);
+ notmuch_status_t (*part)(const void *ctx, struct sprinter *sprinter,
+ struct mime_node *node, int indent,
+ const struct notmuch_show_params *params);
} notmuch_show_format_t;
typedef struct notmuch_show_params {
@@ -85,12 +85,12 @@ typedef struct notmuch_show_params {
*
* Note that __location__ comes from talloc.h.
*/
-#define INTERNAL_ERROR(format, ...) \
- do { \
- fprintf(stderr, \
- "Internal error: " format " (%s)\n", \
- ##__VA_ARGS__, __location__); \
- exit (1); \
+#define INTERNAL_ERROR(format, ...) \
+ do { \
+ fprintf (stderr, \
+ "Internal error: " format " (%s)\n", \
+ ##__VA_ARGS__, __location__); \
+ exit (1); \
} while (0)
#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
@@ -101,8 +101,8 @@ typedef struct notmuch_show_params {
static inline void
chomp_newline (char *str)
{
- if (str && str[strlen(str)-1] == '\n')
- str[strlen(str)-1] = '\0';
+ if (str && str[strlen (str) - 1] == '\n')
+ str[strlen (str) - 1] = '\0';
}
/* Exit status code indicating temporary failure; user is invited to
@@ -251,8 +251,8 @@ json_quote_str (const void *ctx, const char *str);
/* notmuch-config.c */
typedef enum {
- NOTMUCH_CONFIG_OPEN = 1 << 0,
- NOTMUCH_CONFIG_CREATE = 1 << 1,
+ NOTMUCH_CONFIG_OPEN = 1 << 0,
+ NOTMUCH_CONFIG_CREATE = 1 << 1,
} notmuch_config_mode_t;
notmuch_config_t *
@@ -328,8 +328,8 @@ notmuch_config_get_search_exclude_tags (notmuch_config_t *config, size_t *length
void
notmuch_config_set_search_exclude_tags (notmuch_config_t *config,
- const char *list[],
- size_t length);
+ const char *list[],
+ size_t length);
int
notmuch_run_hook (const char *db_path, const char *hook);
@@ -388,7 +388,7 @@ struct mime_node {
/* The list of signatures for signed or encrypted containers. If
* there are no signatures, this will be NULL. */
- GMimeSignatureList* sig_list;
+ GMimeSignatureList *sig_list;
/* Internal: Context inherited from the root iterator. */
struct mime_node_context *ctx;
@@ -435,11 +435,11 @@ mime_node_t *
mime_node_child (mime_node_t *parent, int child);
/* Return the nth child of node in a depth-first traversal. If n is
- * 0, returns node itself. Returns NULL if there is no such part. */
+* 0, returns node itself. Returns NULL if there is no such part. */
mime_node_t *
mime_node_seek_dfs (mime_node_t *node, int n);
-const _notmuch_message_crypto_t*
+const _notmuch_message_crypto_t *
mime_node_get_message_crypto_status (mime_node_t *node);
typedef enum dump_formats {
@@ -449,9 +449,9 @@ typedef enum dump_formats {
} dump_format_t;
typedef enum dump_includes {
- DUMP_INCLUDE_TAGS = 1,
- DUMP_INCLUDE_CONFIG = 2,
- DUMP_INCLUDE_PROPERTIES = 4
+ DUMP_INCLUDE_TAGS = 1,
+ DUMP_INCLUDE_CONFIG = 2,
+ DUMP_INCLUDE_PROPERTIES = 4
} dump_include_t;
#define DUMP_INCLUDE_DEFAULT (DUMP_INCLUDE_TAGS | DUMP_INCLUDE_CONFIG | DUMP_INCLUDE_PROPERTIES)
@@ -467,8 +467,8 @@ 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
print_status_query (const char *loc,
@@ -491,11 +491,11 @@ status_to_exit (notmuch_status_t status);
#include "command-line-arguments.h"
extern const char *notmuch_requested_db_uuid;
-extern const notmuch_opt_desc_t notmuch_shared_options [];
+extern const notmuch_opt_desc_t notmuch_shared_options [];
void notmuch_exit_if_unmatched_db_uuid (notmuch_database_t *notmuch);
-void notmuch_process_shared_options (const char* subcommand_name);
-int notmuch_minimal_options (const char* subcommand_name,
+void notmuch_process_shared_options (const char *subcommand_name);
+int notmuch_minimal_options (const char *subcommand_name,
int argc, char **argv);
@@ -504,10 +504,10 @@ int notmuch_minimal_options (const char* subcommand_name,
struct _notmuch_client_indexing_cli_choices {
int decrypt_policy;
bool decrypt_policy_set;
- notmuch_indexopts_t * opts;
+ notmuch_indexopts_t *opts;
};
extern struct _notmuch_client_indexing_cli_choices indexing_cli_choices;
-extern const notmuch_opt_desc_t notmuch_shared_indexing_options [];
+extern const notmuch_opt_desc_t notmuch_shared_indexing_options [];
notmuch_status_t
notmuch_process_shared_indexing_options (notmuch_database_t *notmuch);
diff --git a/notmuch-config.c b/notmuch-config.c
index 91a24a76..1b079e85 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -151,14 +151,14 @@ get_name_from_passwd_file (void *ctx)
char *name;
int e;
- pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
+ pw_buf_size = sysconf (_SC_GETPW_R_SIZE_MAX);
if (pw_buf_size == -1) pw_buf_size = 64;
pw_buf = talloc_size (ctx, pw_buf_size);
while ((e = getpwuid_r (getuid (), &passwd, pw_buf,
- pw_buf_size, &ignored)) == ERANGE) {
- pw_buf_size = pw_buf_size * 2;
- pw_buf = talloc_zero_size(ctx, pw_buf_size);
+ pw_buf_size, &ignored)) == ERANGE) {
+ pw_buf_size = pw_buf_size * 2;
+ pw_buf = talloc_zero_size (ctx, pw_buf_size);
}
if (e == 0) {
@@ -186,14 +186,14 @@ get_username_from_passwd_file (void *ctx)
char *name;
int e;
- pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
+ pw_buf_size = sysconf (_SC_GETPW_R_SIZE_MAX);
if (pw_buf_size == -1) pw_buf_size = 64;
pw_buf = talloc_zero_size (ctx, pw_buf_size);
while ((e = getpwuid_r (getuid (), &passwd, pw_buf,
- pw_buf_size, &ignored)) == ERANGE) {
- pw_buf_size = pw_buf_size * 2;
- pw_buf = talloc_zero_size(ctx, pw_buf_size);
+ pw_buf_size, &ignored)) == ERANGE) {
+ pw_buf_size = pw_buf_size * 2;
+ pw_buf = talloc_zero_size (ctx, pw_buf_size);
}
if (e == 0)
@@ -217,7 +217,7 @@ get_config_from_file (notmuch_config_t *config, bool create_new)
GError *error = NULL;
bool ret = false;
- FILE *fp = fopen(config->filename, "r");
+ FILE *fp = fopen (config->filename, "r");
if (fp == NULL) {
if (errno == ENOENT) {
/* If create_new is true, then the caller is prepared for a
@@ -233,7 +233,7 @@ get_config_from_file (notmuch_config_t *config, bool create_new)
}
} else {
fprintf (stderr, "Error opening config file '%s': %s\n",
- config->filename, strerror(errno));
+ config->filename, strerror (errno));
}
goto out;
}
@@ -274,12 +274,12 @@ get_config_from_file (notmuch_config_t *config, bool create_new)
g_error_free (error);
-out:
+ out:
if (fp)
- fclose(fp);
+ fclose (fp);
if (config_str)
- talloc_free(config_str);
+ talloc_free (config_str);
return ret;
}
@@ -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,11 +338,12 @@ 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;
}
-
+
talloc_set_destructor (config, notmuch_config_destructor);
/* non-zero defaults */
@@ -438,7 +439,7 @@ notmuch_config_open (void *ctx,
}
if (notmuch_config_get_new_tags (config, &tmp) == NULL) {
- const char *tags[] = { "unread", "inbox" };
+ const char *tags[] = { "unread", "inbox" };
notmuch_config_set_new_tags (config, tags, 2);
}
@@ -499,11 +500,11 @@ notmuch_config_open (void *ctx,
}
/* Close the given notmuch_config_t object, freeing all resources.
- *
+ *
* Note: Any changes made to the configuration are *not* saved by this
* function. To save changes, call notmuch_config_save before
* notmuch_config_close.
-*/
+ */
void
notmuch_config_close (notmuch_config_t *config)
{
@@ -605,13 +606,13 @@ _config_get_list (notmuch_config_t *config,
const char *section, const char *key,
const char ***outlist, size_t *list_length, size_t *ret_length)
{
- assert(outlist);
+ assert (outlist);
/* read from config file and cache value, if not cached already */
if (*outlist == NULL) {
char **inlist = g_key_file_get_string_list (config->key_file,
- section, key, list_length, NULL);
+ section, key, list_length, NULL);
if (inlist) {
unsigned int i;
@@ -648,7 +649,7 @@ _config_set_list (notmuch_config_t *config,
const char *
notmuch_config_get_database_path (notmuch_config_t *config)
{
- char *db_path = (char *)_config_get (config, &config->database_path, "dat