unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch.c: run uncrustify
@ 2012-12-26 15:40 david
  2012-12-29 22:01 ` Tomi Ollila
  0 siblings, 1 reply; 2+ messages in thread
From: david @ 2012-12-26 15:40 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

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...] <search-terms> [...]",
       "Construct a reply template for a set of messages." },
     { "tag", notmuch_tag_command,
-      "+<tag>|-<tag> [...] [--] <search-terms> [...]" ,
+      "+<tag>|-<tag> [...] [--] <search-terms> [...]",
       "Add/remove tags for all messages matching the search terms." },
     { "dump", notmuch_dump_command,
       "[<filename>] [--] [<search-terms>]",
@@ -107,8 +107,8 @@ usage (FILE *out)
 
     fprintf (out, "\n");
     fprintf (out,
-    "Use \"notmuch help <command>\" for more details on each command\n"
-    "and \"notmuch help search-terms\" for the common search-terms syntax.\n\n");
+	     "Use \"notmuch help <command>\" 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] notmuch.c: run uncrustify
  2012-12-26 15:40 [PATCH] notmuch.c: run uncrustify david
@ 2012-12-29 22:01 ` Tomi Ollila
  0 siblings, 0 replies; 2+ messages in thread
From: Tomi Ollila @ 2012-12-29 22:01 UTC (permalink / raw)
  To: david, notmuch; +Cc: David Bremner

On Wed, Dec 26 2012, david@tethera.net wrote:

> From: David Bremner <bremner@debian.org>
>
> 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...] <search-terms> [...]",
>        "Construct a reply template for a set of messages." },
>      { "tag", notmuch_tag_command,
> -      "+<tag>|-<tag> [...] [--] <search-terms> [...]" ,
> +      "+<tag>|-<tag> [...] [--] <search-terms> [...]",
>        "Add/remove tags for all messages matching the search terms." },
>      { "dump", notmuch_dump_command,
>        "[<filename>] [--] [<search-terms>]",
> @@ -107,8 +107,8 @@ usage (FILE *out)
>  
>      fprintf (out, "\n");
>      fprintf (out,
> -    "Use \"notmuch help <command>\" for more details on each command\n"
> -    "and \"notmuch help search-terms\" for the common search-terms syntax.\n\n");
> +	     "Use \"notmuch help <command>\" 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-29 22:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-26 15:40 [PATCH] notmuch.c: run uncrustify david
2012-12-29 22:01 ` Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).