qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/3] tests: add human format test for string out


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 3/3] tests: add human format test for string output visitor
Date: Sun, 22 Jun 2014 13:11:34 +0300

On Fri, Jun 20, 2014 at 09:40:31AM -0600, Eric Blake wrote:
> On 06/19/2014 11:55 PM, Hu Tao wrote:
> > Signed-off-by: Hu Tao <address@hidden>
> > ---
> >  tests/test-string-output-visitor.c | 109 
> > ++++++++++++++++++++++++++++++-------
> >  1 file changed, 90 insertions(+), 19 deletions(-)
> > 
> 
> >  
> > +        len = strlen(EnumOne_lookup[i]) + 2;
> > +        str_human = g_malloc0(len);
> > +        str_human[0] = '"';
> > +        strncpy(str_human + 1, EnumOne_lookup[i], 
> > strlen(EnumOne_lookup[i]));
> > +        str_human[len - 1] = '"';
> 
> Eww.  Just use g_strdup_printf("\"%s\"", EnumOne_lookup[i]), instead of
> futzing around with manual length calculations.
> 
> 
> >  
> > -static void output_visitor_test_add(const char *testpath,
> > -                                    TestOutputVisitorData *data,
> > -                                    void 
> > (*test_func)(TestOutputVisitorData *data, const void *user_data))
> > +static void
> > +output_visitor_test_add(const char *testpath,
> 
> Why the line split? You moved away from the usual qemu style.

We have different styles really, coding style does not say.
And that line's was way too long, so it did need a split.

> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]