test: run uncrustify

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>
This commit is contained in:
Daniel Kahn Gillmor 2019-06-25 13:55:45 -04:00 committed by David Bremner
parent 1959a95d25
commit bdc87f0d3e
9 changed files with 91 additions and 85 deletions

View file

@ -2,24 +2,26 @@
#include "command-line-arguments.h" #include "command-line-arguments.h"
int main(int argc, char **argv){ int
main (int argc, char **argv)
{
int opt_index=1; int opt_index = 1;
int kw_val=0; int kw_val = 0;
int kwb_val=0; int kwb_val = 0;
int fl_val=0; int fl_val = 0;
int int_val=0; int int_val = 0;
const char *pos_arg1=NULL; const char *pos_arg1 = NULL;
const char *pos_arg2=NULL; const char *pos_arg2 = NULL;
const char *string_val=NULL; const char *string_val = NULL;
bool bool_val = false; bool bool_val = false;
bool fl_set = false, int_set = false, bool_set = false, kwb_set = 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[] = { notmuch_opt_desc_t parent_options[] = {
{ .opt_flags = &fl_val, .name = "flag", .present = &fl_set, .keywords = { .opt_flags = &fl_val, .name = "flag", .present = &fl_set, .keywords =
(notmuch_keyword_t []){ { "one", 1 << 0}, (notmuch_keyword_t []){ { "one", 1 << 0 },
{ "two", 1 << 1 }, { "two", 1 << 1 },
{ "three", 1 << 2 }, { "three", 1 << 2 },
{ 0, 0 } } }, { 0, 0 } } },
@ -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) if (opt_index < 0)
return 1; return 1;
if (bool_set) if (bool_set)
printf("boolean %d\n", bool_val); printf ("boolean %d\n", bool_val);
if (kw_set) if (kw_set)
printf("keyword %d\n", kw_val); printf ("keyword %d\n", kw_val);
if (kwb_set) if (kwb_set)
printf("boolkeyword %d\n", kwb_val); printf ("boolkeyword %d\n", kwb_val);
if (fl_set) if (fl_set)
printf("flags %d\n", fl_val); printf ("flags %d\n", fl_val);
if (int_set) if (int_set)
printf("int %d\n", int_val); printf ("int %d\n", int_val);
if (string_set) if (string_set)
printf("string %s\n", string_val); printf ("string %s\n", string_val);
if (pos1_set) if (pos1_set)
printf("positional arg 1 %s\n", pos_arg1); printf ("positional arg 1 %s\n", pos_arg1);
if (pos2_set) 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 ++) { for (; opt_index < argc; opt_index++) {
printf("non parsed arg %d = %s\n", opt_index, argv[opt_index]); printf ("non parsed arg %d = %s\n", opt_index, argv[opt_index]);
} }
return 0; return 0;

View file

@ -2,13 +2,15 @@
#include <cstdlib> #include <cstdlib>
#include <xapian.h> #include <xapian.h>
int main(int argc, char **argv) { int
main (int argc, char **argv)
{
if (argc < 2) { if (argc < 2) {
std::cerr << "usage: ghost-report xapian-dir" << std::endl; std::cerr << "usage: ghost-report xapian-dir" << std::endl;
exit(1); exit (1);
} }
Xapian::Database db(argv[1]); Xapian::Database db (argv[1]);
std::cout << db.get_termfreq("Tghost") << std::endl; std::cout << db.get_termfreq ("Tghost") << std::endl;
} }

View file

@ -29,7 +29,7 @@ xcode (void *ctx, enum direction dir, char *in, char **buf_p, size_t *size_p)
if (inplace) { if (inplace) {
status = hex_decode_inplace (in); status = hex_decode_inplace (in);
*buf_p = in; *buf_p = in;
*size_p = strlen(in); *size_p = strlen (in);
} else { } else {
status = hex_decode (ctx, in, buf_p, size_p); status = hex_decode (ctx, in, buf_p, size_p);
} }

View file

@ -8,7 +8,8 @@
#include <xapian.h> #include <xapian.h>
int main(int argc, char **argv) int
main (int argc, char **argv)
{ {
if (argc != 4) { if (argc != 4) {
fprintf (stderr, "Usage: %s mailpath version features\n", argv[0]); fprintf (stderr, "Usage: %s mailpath version features\n", argv[0]);

View file

@ -4,7 +4,7 @@
#include <notmuch.h> #include <notmuch.h>
inline static void 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); fprintf (stderr, "line %d: %d\n", line, ret);
@ -12,5 +12,5 @@ expect0(int line, notmuch_status_t ret)
} }
} }
#define EXPECT0(v) expect0(__LINE__, v); #define EXPECT0(v) expect0 (__LINE__, v);
#endif #endif

View file

@ -66,7 +66,7 @@ concat_args (int start, int end, char *argv[])
len += strlen (argv[i]) + 1; len += strlen (argv[i]) + 1;
p = malloc (len); p = malloc (len);
if (!p) if (! p)
return NULL; return NULL;
*p = 0; *p = 0;
@ -145,7 +145,7 @@ get_operator (int round)
const char *oper = NULL; const char *oper = NULL;
unsigned int i; unsigned int i;
for (i = 0; i < ARRAY_SIZE(operators); i++) { for (i = 0; i < ARRAY_SIZE (operators); i++) {
if (round == operators[i].round) { if (round == operators[i].round) {
oper = operators[i].operator; oper = operators[i].operator;
break; 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 is trailing whitespace and (optional) comment */
trail = strchr (input, '#'); trail = strchr (input, '#');
if (!trail) if (! trail)
trail = input + len; trail = input + len;
while (trail > input && isspace ((unsigned char) *(trail-1))) while (trail > input && isspace ((unsigned char) *(trail - 1)))
trail--; trail--;
if (trail == input) { if (trail == input) {
@ -184,7 +184,7 @@ parse_stdin (FILE *infile, time_t *ref, int round, const char *format)
} }
tmp = strdup (trail); tmp = strdup (trail);
if (!tmp) { if (! tmp) {
fprintf (stderr, "strdup() failed\n"); fprintf (stderr, "strdup() failed\n");
continue; 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); r = parse_time_string (input, &t, ref, round);
if (!r) { if (! r) {
if (!localtime_r (&t, &tm)) { if (! localtime_r (&t, &tm)) {
fprintf (stderr, "localtime_r() failed\n"); fprintf (stderr, "localtime_r() failed\n");
free (trail); free (trail);
continue; continue;
@ -287,7 +287,7 @@ main (int argc, char *argv[])
return parse_stdin (stdin, nowp, round, format); return parse_stdin (stdin, nowp, round, format);
argstr = concat_args (optind, argc, argv); argstr = concat_args (optind, argc, argv);
if (!argstr) if (! argstr)
return 1; return 1;
r = parse_time_string (argstr, &result, nowp, round); r = parse_time_string (argstr, &result, nowp, round);
@ -304,7 +304,7 @@ main (int argc, char *argv[])
return r; return r;
} }
if (!localtime_r (&result, &tm)) if (! localtime_r (&result, &tm))
return 1; return 1;
strftime (buf, sizeof (buf), format, &tm); strftime (buf, sizeof (buf), format, &tm);

View file

@ -3,7 +3,8 @@
#include <xapian.h> #include <xapian.h>
#include <notmuch.h> #include <notmuch.h>
int main (int argc, char** argv) int
main (int argc, char **argv)
{ {
notmuch_database_t *notmuch; notmuch_database_t *notmuch;
char *message = NULL; char *message = NULL;
@ -22,7 +23,7 @@ int main (int argc, char** argv)
try { try {
(void) new Xapian::WritableDatabase (argv[2], Xapian::DB_OPEN); (void) new Xapian::WritableDatabase (argv[2], Xapian::DB_OPEN);
} catch (const Xapian::Error &error) { } 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; return 0;
} }