[PATCH] notmuch.c: run uncrustify

2012-12-30 Thread Tomi Ollila
On Wed, Dec 26 2012, david at tethera.net wrote:

> From: David Bremner 
>
> In anticipation of doing some updates to this code, it simplifies life
> if the code is "uncrustify clean" to start with
> ---

About an year ago I did some work to preserve format
type (*funcptr) (args)
... i.e. preserve space between (*funcptr) (args) -- among some
other things uncrustify cannot do. 
We could take a closer look to the whole uncrustify business
after 0.15 is out.

Tomi


>  notmuch.c |   23 +++
>  1 file changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/notmuch.c b/notmuch.c
> index 9516dfb..ee2892e 100644
> --- a/notmuch.c
> +++ b/notmuch.c
> @@ -22,7 +22,7 @@
>  
>  #include "notmuch-client.h"
>  
> -typedef int (*command_function_t) (void *ctx, int argc, char *argv[]);
> +typedef int (*command_function_t)(void *ctx, int argc, char *argv[]);
>  
>  typedef struct command {
>  const char *name;
> @@ -39,8 +39,8 @@ typedef struct alias {
>  } alias_t;
>  
>  alias_t aliases[] = {
> -{ "part", { "show", "--format=raw"}},
> -{ "search-tags", {"search", "--output=tags", "*"}}
> +{ "part", { "show", "--format=raw" } },
> +{ "search-tags", { "search", "--output=tags", "*" } }
>  };
>  
>  static int
> @@ -66,7 +66,7 @@ static command_t commands[] = {
>"[options...]  [...]",
>"Construct a reply template for a set of messages." },
>  { "tag", notmuch_tag_command,
> -  "+|- [...] [--]  [...]" ,
> +  "+|- [...] [--]  [...]",
>"Add/remove tags for all messages matching the search terms." },
>  { "dump", notmuch_dump_command,
>"[] [--] []",
> @@ -107,8 +107,8 @@ usage (FILE *out)
>  
>  fprintf (out, "\n");
>  fprintf (out,
> -"Use \"notmuch help \" for more details on each command\n"
> -"and \"notmuch help search-terms\" for the common search-terms 
> syntax.\n\n");
> +  "Use \"notmuch help \" for more details on each command\n"
> +  "and \"notmuch help search-terms\" for the common search-terms 
> syntax.\n\n");
>  }
>  
>  void
> @@ -281,15 +281,14 @@ main (int argc, char *argv[])
>   return notmuch_help_command (NULL, argc - 1, &argv[1]);
>  
>  if (strcmp (argv[1], "--version") == 0) {
> - printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");
> + printf ("notmuch " STRINGIFY (NOTMUCH_VERSION) "\n");
>   return 0;
>  }
>  
>  for (i = 0; i < ARRAY_SIZE (aliases); i++) {
>   alias = &aliases[i];
>  
> - if (strcmp (argv[1], alias->name) == 0)
> - {
> + if (strcmp (argv[1], alias->name) == 0) {
>   int substitutions;
>  
>   argv_local = talloc_size (local, sizeof (char *) *
> @@ -304,14 +303,14 @@ main (int argc, char *argv[])
>   for (j = 0; j < MAX_ALIAS_SUBSTITUTIONS; j++) {
>   if (alias->substitutions[j] == NULL)
>   break;
> - argv_local[j+1] = alias->substitutions[j];
> + argv_local[j + 1] = alias->substitutions[j];
>   }
>   substitutions = j;
>  
>   /* And copy all original arguments (skipping the argument
>* that matched the alias of course. */
>   for (j = 2; j < (unsigned) argc; j++) {
> - argv_local[substitutions+j-1] = argv[j];
> + argv_local[substitutions + j - 1] = argv[j];
>   }
>  
>   argc += substitutions - 1;
> @@ -323,7 +322,7 @@ main (int argc, char *argv[])
>   command = &commands[i];
>  
>   if (strcmp (argv[1], command->name) == 0)
> - return (command->function) (local, argc - 1, &argv[1]);
> + return (command->function)(local, argc - 1, &argv[1]);
>  }
>  
>  fprintf (stderr, "Error: Unknown command '%s' (see \"notmuch help\")\n",
> -- 
> 1.7.10.4
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] notmuch.c: run uncrustify

2012-12-29 Thread Tomi Ollila
On Wed, Dec 26 2012, da...@tethera.net wrote:

> From: David Bremner 
>
> In anticipation of doing some updates to this code, it simplifies life
> if the code is "uncrustify clean" to start with
> ---

About an year ago I did some work to preserve format
type (*funcptr) (args)
... i.e. preserve space between (*funcptr) (args) -- among some
other things uncrustify cannot do. 
We could take a closer look to the whole uncrustify business
after 0.15 is out.

Tomi


>  notmuch.c |   23 +++
>  1 file changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/notmuch.c b/notmuch.c
> index 9516dfb..ee2892e 100644
> --- a/notmuch.c
> +++ b/notmuch.c
> @@ -22,7 +22,7 @@
>  
>  #include "notmuch-client.h"
>  
> -typedef int (*command_function_t) (void *ctx, int argc, char *argv[]);
> +typedef int (*command_function_t)(void *ctx, int argc, char *argv[]);
>  
>  typedef struct command {
>  const char *name;
> @@ -39,8 +39,8 @@ typedef struct alias {
>  } alias_t;
>  
>  alias_t aliases[] = {
> -{ "part", { "show", "--format=raw"}},
> -{ "search-tags", {"search", "--output=tags", "*"}}
> +{ "part", { "show", "--format=raw" } },
> +{ "search-tags", { "search", "--output=tags", "*" } }
>  };
>  
>  static int
> @@ -66,7 +66,7 @@ static command_t commands[] = {
>"[options...]  [...]",
>"Construct a reply template for a set of messages." },
>  { "tag", notmuch_tag_command,
> -  "+|- [...] [--]  [...]" ,
> +  "+|- [...] [--]  [...]",
>"Add/remove tags for all messages matching the search terms." },
>  { "dump", notmuch_dump_command,
>"[] [--] []",
> @@ -107,8 +107,8 @@ usage (FILE *out)
>  
>  fprintf (out, "\n");
>  fprintf (out,
> -"Use \"notmuch help \" for more details on each command\n"
> -"and \"notmuch help search-terms\" for the common search-terms 
> syntax.\n\n");
> +  "Use \"notmuch help \" for more details on each command\n"
> +  "and \"notmuch help search-terms\" for the common search-terms 
> syntax.\n\n");
>  }
>  
>  void
> @@ -281,15 +281,14 @@ main (int argc, char *argv[])
>   return notmuch_help_command (NULL, argc - 1, &argv[1]);
>  
>  if (strcmp (argv[1], "--version") == 0) {
> - printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");
> + printf ("notmuch " STRINGIFY (NOTMUCH_VERSION) "\n");
>   return 0;
>  }
>  
>  for (i = 0; i < ARRAY_SIZE (aliases); i++) {
>   alias = &aliases[i];
>  
> - if (strcmp (argv[1], alias->name) == 0)
> - {
> + if (strcmp (argv[1], alias->name) == 0) {
>   int substitutions;
>  
>   argv_local = talloc_size (local, sizeof (char *) *
> @@ -304,14 +303,14 @@ main (int argc, char *argv[])
>   for (j = 0; j < MAX_ALIAS_SUBSTITUTIONS; j++) {
>   if (alias->substitutions[j] == NULL)
>   break;
> - argv_local[j+1] = alias->substitutions[j];
> + argv_local[j + 1] = alias->substitutions[j];
>   }
>   substitutions = j;
>  
>   /* And copy all original arguments (skipping the argument
>* that matched the alias of course. */
>   for (j = 2; j < (unsigned) argc; j++) {
> - argv_local[substitutions+j-1] = argv[j];
> + argv_local[substitutions + j - 1] = argv[j];
>   }
>  
>   argc += substitutions - 1;
> @@ -323,7 +322,7 @@ main (int argc, char *argv[])
>   command = &commands[i];
>  
>   if (strcmp (argv[1], command->name) == 0)
> - return (command->function) (local, argc - 1, &argv[1]);
> + return (command->function)(local, argc - 1, &argv[1]);
>  }
>  
>  fprintf (stderr, "Error: Unknown command '%s' (see \"notmuch help\")\n",
> -- 
> 1.7.10.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] notmuch.c: run uncrustify

2012-12-26 Thread da...@tethera.net
From: David Bremner 

In anticipation of doing some updates to this code, it simplifies life
if the code is "uncrustify clean" to start with
---
 notmuch.c |   23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/notmuch.c b/notmuch.c
index 9516dfb..ee2892e 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -22,7 +22,7 @@

 #include "notmuch-client.h"

-typedef int (*command_function_t) (void *ctx, int argc, char *argv[]);
+typedef int (*command_function_t)(void *ctx, int argc, char *argv[]);

 typedef struct command {
 const char *name;
@@ -39,8 +39,8 @@ typedef struct alias {
 } alias_t;

 alias_t aliases[] = {
-{ "part", { "show", "--format=raw"}},
-{ "search-tags", {"search", "--output=tags", "*"}}
+{ "part", { "show", "--format=raw" } },
+{ "search-tags", { "search", "--output=tags", "*" } }
 };

 static int
@@ -66,7 +66,7 @@ static command_t commands[] = {
   "[options...]  [...]",
   "Construct a reply template for a set of messages." },
 { "tag", notmuch_tag_command,
-  "+|- [...] [--]  [...]" ,
+  "+|- [...] [--]  [...]",
   "Add/remove tags for all messages matching the search terms." },
 { "dump", notmuch_dump_command,
   "[] [--] []",
@@ -107,8 +107,8 @@ usage (FILE *out)

 fprintf (out, "\n");
 fprintf (out,
-"Use \"notmuch help \" for more details on each command\n"
-"and \"notmuch help search-terms\" for the common search-terms 
syntax.\n\n");
+"Use \"notmuch help \" for more details on each command\n"
+"and \"notmuch help search-terms\" for the common search-terms 
syntax.\n\n");
 }

 void
@@ -281,15 +281,14 @@ main (int argc, char *argv[])
return notmuch_help_command (NULL, argc - 1, &argv[1]);

 if (strcmp (argv[1], "--version") == 0) {
-   printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");
+   printf ("notmuch " STRINGIFY (NOTMUCH_VERSION) "\n");
return 0;
 }

 for (i = 0; i < ARRAY_SIZE (aliases); i++) {
alias = &aliases[i];

-   if (strcmp (argv[1], alias->name) == 0)
-   {
+   if (strcmp (argv[1], alias->name) == 0) {
int substitutions;

argv_local = talloc_size (local, sizeof (char *) *
@@ -304,14 +303,14 @@ main (int argc, char *argv[])
for (j = 0; j < MAX_ALIAS_SUBSTITUTIONS; j++) {
if (alias->substitutions[j] == NULL)
break;
-   argv_local[j+1] = alias->substitutions[j];
+   argv_local[j + 1] = alias->substitutions[j];
}
substitutions = j;

/* And copy all original arguments (skipping the argument
 * that matched the alias of course. */
for (j = 2; j < (unsigned) argc; j++) {
-   argv_local[substitutions+j-1] = argv[j];
+   argv_local[substitutions + j - 1] = argv[j];
}

argc += substitutions - 1;
@@ -323,7 +322,7 @@ main (int argc, char *argv[])
command = &commands[i];

if (strcmp (argv[1], command->name) == 0)
-   return (command->function) (local, argc - 1, &argv[1]);
+   return (command->function)(local, argc - 1, &argv[1]);
 }

 fprintf (stderr, "Error: Unknown command '%s' (see \"notmuch help\")\n",
-- 
1.7.10.4



[PATCH] notmuch.c: run uncrustify

2012-12-26 Thread david
From: David Bremner 

In anticipation of doing some updates to this code, it simplifies life
if the code is "uncrustify clean" to start with
---
 notmuch.c |   23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/notmuch.c b/notmuch.c
index 9516dfb..ee2892e 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -22,7 +22,7 @@
 
 #include "notmuch-client.h"
 
-typedef int (*command_function_t) (void *ctx, int argc, char *argv[]);
+typedef int (*command_function_t)(void *ctx, int argc, char *argv[]);
 
 typedef struct command {
 const char *name;
@@ -39,8 +39,8 @@ typedef struct alias {
 } alias_t;
 
 alias_t aliases[] = {
-{ "part", { "show", "--format=raw"}},
-{ "search-tags", {"search", "--output=tags", "*"}}
+{ "part", { "show", "--format=raw" } },
+{ "search-tags", { "search", "--output=tags", "*" } }
 };
 
 static int
@@ -66,7 +66,7 @@ static command_t commands[] = {
   "[options...]  [...]",
   "Construct a reply template for a set of messages." },
 { "tag", notmuch_tag_command,
-  "+|- [...] [--]  [...]" ,
+  "+|- [...] [--]  [...]",
   "Add/remove tags for all messages matching the search terms." },
 { "dump", notmuch_dump_command,
   "[] [--] []",
@@ -107,8 +107,8 @@ usage (FILE *out)
 
 fprintf (out, "\n");
 fprintf (out,
-"Use \"notmuch help \" for more details on each command\n"
-"and \"notmuch help search-terms\" for the common search-terms 
syntax.\n\n");
+"Use \"notmuch help \" for more details on each command\n"
+"and \"notmuch help search-terms\" for the common search-terms 
syntax.\n\n");
 }
 
 void
@@ -281,15 +281,14 @@ main (int argc, char *argv[])
return notmuch_help_command (NULL, argc - 1, &argv[1]);
 
 if (strcmp (argv[1], "--version") == 0) {
-   printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");
+   printf ("notmuch " STRINGIFY (NOTMUCH_VERSION) "\n");
return 0;
 }
 
 for (i = 0; i < ARRAY_SIZE (aliases); i++) {
alias = &aliases[i];
 
-   if (strcmp (argv[1], alias->name) == 0)
-   {
+   if (strcmp (argv[1], alias->name) == 0) {
int substitutions;
 
argv_local = talloc_size (local, sizeof (char *) *
@@ -304,14 +303,14 @@ main (int argc, char *argv[])
for (j = 0; j < MAX_ALIAS_SUBSTITUTIONS; j++) {
if (alias->substitutions[j] == NULL)
break;
-   argv_local[j+1] = alias->substitutions[j];
+   argv_local[j + 1] = alias->substitutions[j];
}
substitutions = j;
 
/* And copy all original arguments (skipping the argument
 * that matched the alias of course. */
for (j = 2; j < (unsigned) argc; j++) {
-   argv_local[substitutions+j-1] = argv[j];
+   argv_local[substitutions + j - 1] = argv[j];
}
 
argc += substitutions - 1;
@@ -323,7 +322,7 @@ main (int argc, char *argv[])
command = &commands[i];
 
if (strcmp (argv[1], command->name) == 0)
-   return (command->function) (local, argc - 1, &argv[1]);
+   return (command->function)(local, argc - 1, &argv[1]);
 }
 
 fprintf (stderr, "Error: Unknown command '%s' (see \"notmuch help\")\n",
-- 
1.7.10.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch