From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzEEE-0005gq-QJ for qemu-devel@nongnu.org; Tue, 25 Oct 2016 22:46:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzEEB-0007J5-O9 for qemu-devel@nongnu.org; Tue, 25 Oct 2016 22:46:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47966) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzEEB-0007Im-J7 for qemu-devel@nongnu.org; Tue, 25 Oct 2016 22:46:07 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9DD7C61A1B for ; Wed, 26 Oct 2016 02:46:06 +0000 (UTC) Date: Wed, 26 Oct 2016 10:46:04 +0800 From: Fam Zheng Message-ID: <20161026024604.GC14605@lemon> References: <1477447172-19677-1-git-send-email-famz@redhat.com> <0137c2f9-8e21-1269-8c60-f33dd8850ca9@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0137c2f9-8e21-1269-8c60-f33dd8850ca9@redhat.com> Subject: Re: [Qemu-devel] [PATCH] trace: Fix 'char **' compilation error in simple backend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Stefan Hajnoczi On Tue, 10/25 21:29, Eric Blake wrote: > On 10/25/2016 08:59 PM, Fam Zheng wrote: > > Currently, the generated function body will do "strlen(arg)" but the > > argument could be 'char **'. Avoid that by exclusding such cases in > > s/exclusding/excluding/ Yes, I blame the insomnia last night. @.@ I assume this can be fixed when applying. > > > is_string check. > > > > Reported by patchew's "make docker-test-mingw@fedora". > > > > Signed-off-by: Fam Zheng > > --- > > scripts/tracetool/backend/simple.py | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py > > index 9885e83..2538795 100644 > > --- a/scripts/tracetool/backend/simple.py > > +++ b/scripts/tracetool/backend/simple.py > > @@ -21,7 +21,9 @@ PUBLIC = True > > > > def is_string(arg): > > strtype = ('const char*', 'char*', 'const char *', 'char *') > > - if arg.lstrip().startswith(strtype): > > + non_strtype = ('const char**', 'char**', 'const char **', 'char **') > > + arg_strip = arg.lstrip() > > + if arg_strip.startswith(strtype) and not arg_strip.startswith(non_strtype): > > There may be a more compact way to write it, but I'm not enough of a > python expert to know offhand what else to suggest (it's not as simple > as string concatenation of strtype + '*', since strtype is a tuple > rather than a string). Did you mean non_strtype = tuple(x + '*' for x in strtype) ? But personally I'd stick to the flatten version in this specific case for a bit more readability. Thanks! Fam