Re: [PATCH v4 2/3] Add structured output formatter for JSON.

Subject: Re: [PATCH v4 2/3] Add structured output formatter for JSON.

Date: Thu, 12 Jul 2012 16:34:59 -0400

To: Tomi Ollila

Cc: notmuch@notmuchmail.org

From: Austin Clements


Quoth Tomi Ollila on Jul 12 at  1:10 pm:
> On Thu, Jul 12 2012, craven@gmx.net wrote:
> 
> > Using the new structured printer support in sprinter.h, implement
> > sprinter_json_new, which returns a new JSON structured output
> > formatter.
> >
> > The formatter prints output similar to the existing JSON, but with
> > differences in whitespace (mostly newlines).
> > ---
> >  Makefile.local |   1 +
> >  sprinter.c     | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 173 insertions(+)
> >  create mode 100644 sprinter.c
> >
> > diff --git a/Makefile.local b/Makefile.local
> > index a890df2..8baf0c2 100644
> > --- a/Makefile.local
> > +++ b/Makefile.local
> > @@ -290,6 +290,7 @@ notmuch_client_srcs =		\
> >  	notmuch-show.c		\
> >  	notmuch-tag.c		\
> >  	notmuch-time.c		\
> > +	sprinter.c		\
> >  	query-string.c		\
> >  	mime-node.c		\
> >  	crypto.c		\
> > diff --git a/sprinter.c b/sprinter.c
> > new file mode 100644
> > index 0000000..649f79a
> > --- /dev/null
> > +++ b/sprinter.c
> > @@ -0,0 +1,172 @@
> > +#include <stdbool.h>
> > +#include <stdio.h>
> > +#include <talloc.h>
> > +#include "sprinter.h"
> > +
> > +#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
> 
> You're including sprinter.h which includes notmuch-client.h which
> defines ARRAY_SIZE (Interesting that you did not get error(/warning?)
> about this)
> 
> Rest looks good -- except the whitespace -- as I looked through Austin's
> code yesterday you're just replicated the same lines :D. Easiest
> to fix is probably just running 
> uncrustify -c devel/uncrustify.cfg --replace sprinter.c 

Oops.  Shame on me.  Is anything wrong besides the missing space
before the argument list of all of the function declarations?

Thread: