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: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 3/3] tests: add human format test for string output visitor
Date: Fri, 20 Jun 2014 09:40:31 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

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.

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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