From: David Bremner <david@tethera.net>
To: Austin Clements <amdragon@MIT.EDU>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH 2/2] notmuch-reply.c: uncrustify
Date: Thu, 12 Jan 2012 09:08:18 -0400 [thread overview]
Message-ID: <87r4z56pbx.fsf@zancas.localnet> (raw)
In-Reply-To: <20120112035739.GW20796@mit.edu>
On Wed, 11 Jan 2012 22:57:39 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
> > From: David Bremner <bremner@debian.org>
> >
> > This patch shows the raw result of running uncrustify on notmuch-reply.c.
> > The re-indenting of "format_reply" would probably not be desirable.
>
> The good news is that that structure is on its way out.
>
> > @@ -625,6 +612,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
> > notmuch_query_t *query;
> > char *query_string;
> > int opt_index, ret = 0;
> > +
>
> This one's a little weird. Did it get confused by the function
> prototype?
Yes, I think it is thinking the block of variable declarations ends
there.
> All of the other format fixes look very reasonable to me. I think you
> managed to find one of the least canonical source files in the tree.
> Was that intentional?
Yes, I expect there would be less changes elsewhere. Although the
changes might be more controversial, I guess.
The corresponding diff for notmuch-search.c follows
diff --git a/notmuch-search.c b/notmuch-search.c
index 4baab56..8928e62 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -31,16 +31,16 @@ typedef enum {
typedef struct search_format {
const char *results_start;
const char *item_start;
- void (*item_id) (const void *ctx,
- const char *item_type,
- const char *item_id);
- void (*thread_summary) (const void *ctx,
- const char *thread_id,
- const time_t date,
- const int matched,
- const int total,
- const char *authors,
- const char *subject);
+ void (*item_id)(const void *ctx,
+ const char *item_type,
+ const char *item_id);
+ void (*thread_summary)(const void *ctx,
+ const char *thread_id,
+ const time_t date,
+ const int matched,
+ const int total,
+ const char *authors,
+ const char *subject);
const char *tag_start;
const char *tag;
const char *tag_sep;
@@ -66,13 +66,13 @@ format_thread_text (const void *ctx,
const char *subject);
static const search_format_t format_text = {
"",
- "",
- format_item_id_text,
- format_thread_text,
- " (",
- "%s", " ",
- ")", "\n",
- "",
+ "",
+ format_item_id_text,
+ format_thread_text,
+ " (",
+ "%s", " ",
+ ")", "\n",
+ "",
"\n",
"",
};
@@ -92,13 +92,13 @@ format_thread_json (const void *ctx,
const char *subject);
static const search_format_t format_json = {
"[",
- "{",
- format_item_id_json,
- format_thread_json,
- "\"tags\": [",
- "\"%s\"", ", ",
- "]", ",\n",
- "}",
+ "{",
+ format_item_id_json,
+ format_thread_json,
+ "\"tags\": [",
+ "\"%s\"", ", ",
+ "]", ",\n",
+ "}",
"]\n",
"]\n",
};
@@ -122,7 +122,7 @@ sanitize_string (const void *ctx, const char *str)
loop = out = talloc_strdup (ctx, str);
for (; *loop; loop++) {
- if ((unsigned char)(*loop) < 32)
+ if ((unsigned char) (*loop) < 32)
*loop = '?';
}
return out;
@@ -160,7 +160,7 @@ format_item_id_json (const void *ctx,
printf ("%s", json_quote_str (ctx_quote, item_id));
talloc_free (ctx_quote);
-
+
}
static void
@@ -221,8 +221,7 @@ do_search_threads (const search_format_t *format,
for (i = 0;
notmuch_threads_valid (threads) && (limit < 0 || i < offset + limit);
- notmuch_threads_move_to_next (threads), i++)
- {
+ notmuch_threads_move_to_next (threads), i++) {
int first_tag = 1;
thread = notmuch_threads_get (threads);
@@ -232,7 +231,7 @@ do_search_threads (const search_format_t *format,
continue;
}
- if (! first_thread)
+ if (!first_thread)
fputs (format->item_sep, stdout);
if (output == OUTPUT_THREADS) {
@@ -258,9 +257,8 @@ do_search_threads (const search_format_t *format,
for (tags = notmuch_thread_get_tags (thread);
notmuch_tags_valid (tags);
- notmuch_tags_move_to_next (tags))
- {
- if (! first_tag)
+ notmuch_tags_move_to_next (tags)) {
+ if (!first_tag)
fputs (format->tag_sep, stdout);
printf (format->tag, notmuch_tags_get (tags));
first_tag = 0;
@@ -311,8 +309,7 @@ do_search_messages (const search_format_t *format,
for (i = 0;
notmuch_messages_valid (messages) && (limit < 0 || i < offset + limit);
- notmuch_messages_move_to_next (messages), i++)
- {
+ notmuch_messages_move_to_next (messages), i++) {
if (i < offset)
continue;
@@ -323,9 +320,8 @@ do_search_messages (const search_format_t *format,
for (;
notmuch_filenames_valid (filenames);
- notmuch_filenames_move_to_next (filenames))
- {
- if (! first_message)
+ notmuch_filenames_move_to_next (filenames)) {
+ if (!first_message)
fputs (format->item_sep, stdout);
format->item_id (message, "",
@@ -333,11 +329,11 @@ do_search_messages (const search_format_t *format,
first_message = 0;
}
-
- notmuch_filenames_destroy( filenames );
+
+ notmuch_filenames_destroy ( filenames );
} else { /* output == OUTPUT_MESSAGES */
- if (! first_message)
+ if (!first_message)
fputs (format->item_sep, stdout);
format->item_id (message, "id:",
@@ -385,11 +381,10 @@ do_search_tags (notmuch_database_t *notmuch,
for (;
notmuch_tags_valid (tags);
- notmuch_tags_move_to_next (tags))
- {
+ notmuch_tags_move_to_next (tags)) {
tag = notmuch_tags_get (tags);
- if (! first_tag)
+ if (!first_tag)
fputs (format->item_sep, stdout);
format->item_id (tags, "", tag);
@@ -425,7 +420,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
int limit = -1; /* unlimited */
enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
- format_sel = NOTMUCH_FORMAT_TEXT;
+ format_sel = NOTMUCH_FORMAT_TEXT;
notmuch_opt_desc_t options[] = {
{ NOTMUCH_OPT_KEYWORD, &sort, "sort", 's',
@@ -472,7 +467,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
if (notmuch == NULL)
return 1;
- query_str = query_string_from_args (notmuch, argc-opt_index, argv+opt_index);
+ query_str = query_string_from_args (notmuch, argc - opt_index, argv + opt_index);
if (query_str == NULL) {
fprintf (stderr, "Out of memory.\n");
return 1;
next prev parent reply other threads:[~2012-01-12 13:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-17 15:28 [PATCH] uncrustify.cfg: initial support for notmuch coding style David Bremner
2011-12-17 22:50 ` David Bremner
2011-12-17 23:57 ` Austin Clements
2011-12-18 1:37 ` David Bremner
2012-01-10 12:07 ` David Bremner
2012-01-10 12:07 ` [PATCH 1/2] uncrustify.cfg: initial support for notmuch coding style David Bremner
2012-01-12 4:00 ` Austin Clements
2012-01-17 15:36 ` Tomi Ollila
2012-01-21 21:15 ` David Bremner
2012-01-21 21:35 ` Tomi Ollila
2012-01-10 12:07 ` [PATCH 2/2] notmuch-reply.c: uncrustify David Bremner
2012-01-11 15:22 ` Tomi Ollila
2012-01-12 3:57 ` Austin Clements
2012-01-12 13:08 ` David Bremner [this message]
2012-01-12 13:22 ` Jani Nikula
2012-01-12 13:46 ` Tomi Ollila
2012-01-12 15:26 ` Austin Clements
2012-01-21 19:00 ` David Bremner
2012-01-11 16:03 ` where to put uncrustify... (was: Re: ) Tomi Ollila
2012-01-12 0:15 ` David Bremner
2012-01-17 12:47 ` [PATCH] Start devel directory for developer tools and documentation David Bremner
2012-01-17 23:23 ` Austin Clements
2012-01-18 2:54 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r4z56pbx.fsf@zancas.localnet \
--to=david@tethera.net \
--cc=amdragon@MIT.EDU \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).