]> git.notmuchmail.org Git - notmuch/commitdiff
test: run uncrustify
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 25 Jun 2019 17:55:45 +0000 (13:55 -0400)
committerDavid Bremner <david@tethera.net>
Sat, 29 Jun 2019 19:18:15 +0000 (21:18 +0200)
This is the result of running:

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

in the test directory.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
test/arg-test.c
test/ghost-report.cc
test/hex-xcode.c
test/make-db-version.cc
test/notmuch-test.h
test/parse-time.c
test/random-corpus.c
test/smtp-dummy.c
test/symbol-test.cc

index a218f967e7ff01665b1575a63e44b2b1dae3ac41..44477730c274f32146bdee71e63d9b5d0c61ab78 100644 (file)
@@ -2,27 +2,29 @@
 #include "command-line-arguments.h"
 
 
-int main(int argc, char **argv){
-
-    int opt_index=1;
-
-    int kw_val=0;
-    int kwb_val=0;
-    int fl_val=0;
-    int int_val=0;
-    const char *pos_arg1=NULL;
-    const char *pos_arg2=NULL;
-    const char *string_val=NULL;
+int
+main (int argc, char **argv)
+{
+
+    int opt_index = 1;
+
+    int kw_val = 0;
+    int kwb_val = 0;
+    int fl_val = 0;
+    int int_val = 0;
+    const char *pos_arg1 = NULL;
+    const char *pos_arg2 = NULL;
+    const char *string_val = NULL;
     bool bool_val = false;
     bool fl_set = false, int_set = false, bool_set = false, kwb_set = false,
-       kw_set = false, string_set = false, pos1_set = false, pos2_set = false;
+        kw_set = false, string_set = false, pos1_set = false, pos2_set = false;
 
     notmuch_opt_desc_t parent_options[] = {
        { .opt_flags = &fl_val, .name = "flag", .present = &fl_set, .keywords =
-         (notmuch_keyword_t []){ { "one",   1 << 0},
-                                 { "two",   1 << 1 },
-                                 { "three", 1 << 2 },
-                                 { 0, 0 } } },
+             (notmuch_keyword_t []){ { "one",   1 << 0 },
+                                     { "two",   1 << 1 },
+                                     { "three", 1 << 2 },
+                                     { 0, 0 } } },
        { .opt_int = &int_val, .name = "int", .present = &int_set },
        { }
     };
@@ -30,16 +32,16 @@ int main(int argc, char **argv){
     notmuch_opt_desc_t options[] = {
        { .opt_bool = &bool_val, .name = "boolean", .present = &bool_set },
        { .opt_keyword = &kw_val, .name = "keyword", .present = &kw_set, .keywords =
-         (notmuch_keyword_t []){ { "zero", 0 },
-                                 { "one", 1 },
-                                 { "two", 2 },
-                                 { 0, 0 } } },
+             (notmuch_keyword_t []){ { "zero", 0 },
+                                     { "one", 1 },
+                                     { "two", 2 },
+                                     { 0, 0 } } },
        { .opt_keyword = &kwb_val, .name = "boolkeyword", .present = &kwb_set,
          .keyword_no_arg_value = "true", .keywords =
-         (notmuch_keyword_t []){ { "false", 0 },
-                                 { "true", 1 },
-                                 { "auto", 2 },
-                                 { 0, 0 } } },
+             (notmuch_keyword_t []){ { "false", 0 },
+                                     { "true", 1 },
+                                     { "auto", 2 },
+                                     { 0, 0 } } },
        { .opt_inherit = parent_options },
        { .opt_string = &string_val, .name = "string", .present = &string_set },
        { .opt_position = &pos_arg1, .present = &pos1_set },
@@ -47,38 +49,38 @@ int main(int argc, char **argv){
        { }
     };
 
-    opt_index = parse_arguments(argc, argv, options, 1);
+    opt_index = parse_arguments (argc, argv, options, 1);
 
     if (opt_index < 0)
        return 1;
 
     if (bool_set)
-       printf("boolean %d\n", bool_val);
+       printf ("boolean %d\n", bool_val);
 
     if (kw_set)
-       printf("keyword %d\n", kw_val);
+       printf ("keyword %d\n", kw_val);
 
     if (kwb_set)
-       printf("boolkeyword %d\n", kwb_val);
+       printf ("boolkeyword %d\n", kwb_val);
 
     if (fl_set)
-       printf("flags %d\n", fl_val);
+       printf ("flags %d\n", fl_val);
 
     if (int_set)
-       printf("int %d\n", int_val);
+       printf ("int %d\n", int_val);
 
     if (string_set)
-       printf("string %s\n", string_val);
+       printf ("string %s\n", string_val);
 
     if (pos1_set)
-       printf("positional arg 1 %s\n", pos_arg1);
+       printf ("positional arg 1 %s\n", pos_arg1);
 
     if (pos2_set)
-       printf("positional arg 2 %s\n", pos_arg2);
+       printf ("positional arg 2 %s\n", pos_arg2);
 
 
-    for ( ; opt_index < argc ; opt_index ++) {
-       printf("non parsed arg %d = %s\n", opt_index, argv[opt_index]);
+    for (; opt_index < argc; opt_index++) {
+       printf ("non parsed arg %d = %s\n", opt_index, argv[opt_index]);
     }
 
     return 0;
index 3e1b07c60224777ad8d5f79c9d5a1427bbafffa8..fad9a71d9a14d99ad2a9f553b0ba134d21887b82 100644 (file)
@@ -2,13 +2,15 @@
 #include <cstdlib>
 #include <xapian.h>
 
-int main(int argc, char **argv) {
+int
+main (int argc, char **argv)
+{
 
     if (argc < 2) {
        std::cerr << "usage: ghost-report xapian-dir" << std::endl;
-       exit(1);
+       exit (1);
     }
 
-    Xapian::Database db(argv[1]);
-    std::cout << db.get_termfreq("Tghost") << std::endl;
+    Xapian::Database db (argv[1]);
+    std::cout << db.get_termfreq ("Tghost") << std::endl;
 }
index 33046e9a51785378d5f5003469941f1f428a2755..2e70f737fa1c2346ab59d628cd3f8645bf90789e 100644 (file)
@@ -26,13 +26,13 @@ xcode (void *ctx, enum direction dir, char *in, char **buf_p, size_t *size_p)
     if (dir == ENCODE)
        status = hex_encode (ctx, in, buf_p, size_p);
     else
-       if (inplace) {
-           status = hex_decode_inplace (in);
-           *buf_p = in;
-           *size_p = strlen(in);
-       } else {
-           status = hex_decode (ctx, in, buf_p, size_p);
-       }
+    if (inplace) {
+       status = hex_decode_inplace (in);
+       *buf_p = in;
+       *size_p = strlen (in);
+    } else {
+       status = hex_decode (ctx, in, buf_p, size_p);
+    }
 
     if (status == HEX_SUCCESS)
        fputs (*buf_p, stdout);
@@ -49,9 +49,9 @@ main (int argc, char **argv)
 
     notmuch_opt_desc_t options[] = {
        { .opt_keyword = &dir, .name = "direction", .keywords =
-         (notmuch_keyword_t []){ { "encode", ENCODE },
-                                 { "decode", DECODE },
-                                 { 0, 0 } } },
+             (notmuch_keyword_t []){ { "encode", ENCODE },
+                                     { "decode", DECODE },
+                                     { 0, 0 } } },
        { .opt_bool = &omit_newline, .name = "omit-newline" },
        { .opt_bool = &inplace, .name = "in-place" },
        { }
index fa80cac9d321993154e29bd5ea52ae8d43aa5809..78feaf7269fdf3c9c492e8ae15070260bd91a6e5 100644 (file)
@@ -8,7 +8,8 @@
 
 #include <xapian.h>
 
-int main(int argc, char **argv)
+int
+main (int argc, char **argv)
 {
     if (argc != 4) {
        fprintf (stderr, "Usage: %s mailpath version features\n", argv[0]);
index 45d03d67540a795540da7287e1212d460b6289af..df852da9de552fd35dd7305018d001763e6aa7c3 100644 (file)
@@ -4,13 +4,13 @@
 #include <notmuch.h>
 
 inline static void
-expect0(int line, notmuch_status_t ret)
+expect0 (int line, notmuch_status_t ret)
 {
-   if (ret) {
+    if (ret) {
        fprintf (stderr, "line %d: %d\n", line, ret);
        exit (1);
-   }
+    }
 }
 
-#define EXPECT0(v)  expect0(__LINE__, v);
+#define EXPECT0(v)  expect0 (__LINE__, v);
 #endif
index 694761cf1742d1179d6e5e80df61ff2f856f306b..6aac89b9937cf65cefc1af6b372f4f77e05bd536 100644 (file)
 #define ARRAY_SIZE(a) (sizeof (a) / sizeof (a[0]))
 
 static const char *parse_time_error_strings[] = {
-    [PARSE_TIME_OK]                    = "OK",
-    [PARSE_TIME_ERR]                   = "ERR",
-    [PARSE_TIME_ERR_LIB]               = "LIB",
-    [PARSE_TIME_ERR_ALREADYSET]                = "ALREADYSET",
-    [PARSE_TIME_ERR_FORMAT]            = "FORMAT",
-    [PARSE_TIME_ERR_DATEFORMAT]                = "DATEFORMAT",
-    [PARSE_TIME_ERR_TIMEFORMAT]                = "TIMEFORMAT",
-    [PARSE_TIME_ERR_INVALIDDATE]       = "INVALIDDATE",
-    [PARSE_TIME_ERR_INVALIDTIME]       = "INVALIDTIME",
-    [PARSE_TIME_ERR_KEYWORD]           = "KEYWORD",
+    [PARSE_TIME_OK] = "OK",
+    [PARSE_TIME_ERR] = "ERR",
+    [PARSE_TIME_ERR_LIB] = "LIB",
+    [PARSE_TIME_ERR_ALREADYSET] = "ALREADYSET",
+    [PARSE_TIME_ERR_FORMAT] = "FORMAT",
+    [PARSE_TIME_ERR_DATEFORMAT] = "DATEFORMAT",
+    [PARSE_TIME_ERR_TIMEFORMAT] = "TIMEFORMAT",
+    [PARSE_TIME_ERR_INVALIDDATE] = "INVALIDDATE",
+    [PARSE_TIME_ERR_INVALIDTIME] = "INVALIDTIME",
+    [PARSE_TIME_ERR_KEYWORD] = "KEYWORD",
 };
 
 static const char *
@@ -66,7 +66,7 @@ concat_args (int start, int end, char *argv[])
        len += strlen (argv[i]) + 1;
 
     p = malloc (len);
-    if (!p)
+    if (! p)
        return NULL;
 
     *p = 0;
@@ -111,10 +111,10 @@ struct {
     const char *operator;
     int round;
 } operators[] = {
-    { "==>",   PARSE_TIME_NO_ROUND },
-    { "==_>",  PARSE_TIME_ROUND_DOWN },
-    { "==^>",  PARSE_TIME_ROUND_UP_INCLUSIVE },
-    { "==^^>", PARSE_TIME_ROUND_UP },
+    { "==>",    PARSE_TIME_NO_ROUND },
+    { "==_>",   PARSE_TIME_ROUND_DOWN },
+    { "==^>",   PARSE_TIME_ROUND_UP_INCLUSIVE },
+    { "==^^>",  PARSE_TIME_ROUND_UP },
 };
 
 static const char *
@@ -145,7 +145,7 @@ get_operator (int round)
     const char *oper = NULL;
     unsigned int i;
 
-    for (i = 0; i < ARRAY_SIZE(operators); i++) {
+    for (i = 0; i < ARRAY_SIZE (operators); i++) {
        if (round == operators[i].round) {
            oper = operators[i].operator;
            break;
@@ -172,10 +172,10 @@ parse_stdin (FILE *infile, time_t *ref, int round, const char *format)
 
        /* trail is trailing whitespace and (optional) comment */
        trail = strchr (input, '#');
-       if (!trail)
+       if (! trail)
            trail = input + len;
 
-       while (trail > input && isspace ((unsigned char) *(trail-1)))
+       while (trail > input && isspace ((unsigned char) *(trail - 1)))
            trail--;
 
        if (trail == input) {
@@ -184,7 +184,7 @@ parse_stdin (FILE *infile, time_t *ref, int round, const char *format)
        }
 
        tmp = strdup (trail);
-       if (!tmp) {
+       if (! tmp) {
            fprintf (stderr, "strdup() failed\n");
            continue;
        }
@@ -201,8 +201,8 @@ parse_stdin (FILE *infile, time_t *ref, int round, const char *format)
        }
 
        r = parse_time_string (input, &t, ref, round);
-       if (!r) {
-           if (!localtime_r (&t, &tm)) {
+       if (! r) {
+           if (! localtime_r (&t, &tm)) {
                fprintf (stderr, "localtime_r() failed\n");
                free (trail);
                continue;
@@ -239,12 +239,12 @@ main (int argc, char *argv[])
     char buf[1024];
     const char *format = DEFAULT_FORMAT;
     struct option options[] = {
-       { "help",       no_argument,            NULL,   'h' },
-       { "^",          no_argument,            NULL,   'u' },
-       { "^^",         no_argument,            NULL,   'U' },
-       { "_",          no_argument,            NULL,   'd' },
-       { "format",     required_argument,      NULL,   'f' },
-       { "ref",        required_argument,      NULL,   'r' },
+       { "help",       no_argument,            NULL,   'h' },
+       { "^",          no_argument,            NULL,   'u' },
+       { "^^",         no_argument,            NULL,   'U' },
+       { "_",          no_argument,            NULL,   'd' },
+       { "format",     required_argument,      NULL,   'f' },
+       { "ref",        required_argument,      NULL,   'r' },
        { NULL, 0, NULL, 0 },
     };
 
@@ -287,7 +287,7 @@ main (int argc, char *argv[])
        return parse_stdin (stdin, nowp, round, format);
 
     argstr = concat_args (optind, argc, argv);
-    if (!argstr)
+    if (! argstr)
        return 1;
 
     r = parse_time_string (argstr, &result, nowp, round);
@@ -304,7 +304,7 @@ main (int argc, char *argv[])
        return r;
     }
 
-    if (!localtime_r (&result, &tm))
+    if (! localtime_r (&result, &tm))
        return 1;
 
     strftime (buf, sizeof (buf), format, &tm);
index 9272afda8bedab235293a870ed9de794943e6dc0..8ed7ff766cdd274844515038e07d1384b0180407 100644 (file)
@@ -116,7 +116,7 @@ random_utf8_string (void *ctx, size_t char_count)
 
 /* stubs since we cannot link with notmuch.o */
 const notmuch_opt_desc_t notmuch_shared_options[] = {
-       { }
+    { }
 };
 
 const char *notmuch_requested_db_uuid = NULL;
index a7c1fe4fe822417d8bfb9819144627b522290a6e..1c89e9af81232add629fa49d3f818a096ae27d85 100644 (file)
@@ -275,7 +275,7 @@ main (int argc, char *argv[])
 
     do_smtp_to_file (peer_file, output);
 
- DONE:
 DONE:
     if (output)
        fclose (output);
     if (peer_file)
index 7454838bfd3125e2de08ad9f5fd9977363900e87..9d73a571a71e5f733ca09c0cca57725a4dda7de3 100644 (file)
@@ -3,7 +3,8 @@
 #include <xapian.h>
 #include <notmuch.h>
 
-int main (int argc, char** argv)
+int
+main (int argc, char **argv)
 {
     notmuch_database_t *notmuch;
     char *message = NULL;
@@ -22,7 +23,7 @@ int main (int argc, char** argv)
     try {
        (void) new Xapian::WritableDatabase (argv[2], Xapian::DB_OPEN);
     } catch (const Xapian::Error &error) {
-       printf("caught %s\n", error.get_msg().c_str());
+       printf ("caught %s\n", error.get_msg ().c_str ());
        return 0;
     }