mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 01:14:53 +01:00
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:
parent
1959a95d25
commit
bdc87f0d3e
9 changed files with 91 additions and 85 deletions
|
@ -2,27 +2,29 @@
|
|||
#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 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 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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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" },
|
||||
{ }
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -30,16 +30,16 @@
|
|||
#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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue