qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] trace: Fix 'char **' compilation error in simpl


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH] trace: Fix 'char **' compilation error in simple backend
Date: Wed, 26 Oct 2016 10:46:04 +0800
User-agent: Mutt/1.7.1 (2016-10-04)

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 address@hidden".
> > 
> > Signed-off-by: Fam Zheng <address@hidden>
> > ---
> >  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



reply via email to

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