From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wyek5-0006HZ-Ur for qemu-devel@nongnu.org; Sun, 22 Jun 2014 06:11:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wyek1-0000b8-Ac for qemu-devel@nongnu.org; Sun, 22 Jun 2014 06:11:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wyek1-0000ap-2s for qemu-devel@nongnu.org; Sun, 22 Jun 2014 06:11:17 -0400 Date: Sun, 22 Jun 2014 13:11:34 +0300 From: "Michael S. Tsirkin" Message-ID: <20140622101134.GA17067@redhat.com> References: <61b0b2f7ec170edcbe9dd45d6f098ae50c1178f9.1403243169.git.hutao@cn.fujitsu.com> <53A455EF.8050308@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53A455EF.8050308@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/3] tests: add human format test for string output visitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Hu Tao , Paolo Bonzini , qemu-devel@nongnu.org, Yasunori Goto 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 > > --- > > 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 >