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

Re: [XEN PATCH v4 3/3] build: compat-xlat-header.py: optimisation to search for just '{' instead of [{}]


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Mon, 23 Jan 2023 10:30:30 +0000
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 23 Jan 2023 10:31:17 +0000
  • Ironport-data: A9a23:eXpABqhUytoG1ZJCDvmdItofX161qBAKZh0ujC45NGQN5FlHY01je htvWWzXbPreM2v8cosjao/no0kHuJPWzYdjHQM5q3gzRSwb9cadCdqndUqhZCn6wu8v7q5Ex 55HNoSfdpBcolv0/ErF3m3J9CEkvU2wbuOgTrWCYmUpH1QMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMRqu1iUc3lg8sspvkzsy+qWt0N8klgZmP6sT5QWFzyB94K83fsldEVOpGuG4IcbiL wrz5OnR1n/U+R4rFuSknt7TGqHdauePVeQmoiM+t5mK2nCulARrukoIHKN0hXNsoyeIh7hMJ OBl7vRcf+uL0prkw4zxWzEAe8130DYvFLXveRBTuuTLp6HKnueFL1yDwyjaMKVBktubD12i+ tRBKA0EPxGT2Nntg4mmZLB+tu0oDe3kadZ3VnFIlVk1DN4jSJHHBa7L+cVZzHE7gcUm8fT2P pRDL2A1NVKZPkMJYw1MYH49tL7Aan3XejtEqFWTtOwv7nLa1gBZ27nxKtvFPNeNQK25m27J/ TidrzymW3n2MvTPxCKqolWMttSUthjfRb0WP7Hnp7111Qj7Kms7V0RNCArTTeOCol6zXZdTJ lIZ/gIqrLMu7wq7Q9/lRRq6rXWY+BkGVLJ4Eec39QWMwar8+BuCCy4PSTspQN47sM47QxQ62 1nPmMnmbRR0q6GcQ3+Z8raSrBuxNDITIGtEYjULJSMa5/HzrYd1iQjAJv5qCKOvh8f5MS3xy TuN6iM5gt0uYdUjjvvhuwqd2nT1+8aPF1RujunKYo67xlp5WYf0Zpz30gOY1utudZSpZ1Kgm HdRzqBy89syJZ2KkSWMRsAEE7eo++uJPVXgvLJ/I3Uy32/zoiD+JOi89Bk7fR40aZhcJVcFd WeJ4WtsCIlv0GxGhEOdS6a4EIwUwKfpDrwJvdiEP4MVMvCdmOJqlRyChHJ8PUi3yyDAcollY /93lPpA6l5EYZmLNBLsG48gPUYDn0jSP1/7S5Hh1AiA2rGDfnOTQrptGALQMbxltfnf/12Fq Yc32y62J/J3Cb2WX8Uq2dRLcQBiwYYTW/gaVPC7hsbce1E7SQnN+tfawK87epwNokimvr6gw 51JYWcBkACXrSSeeW23hoVLNOuHsWBX8ShqYkTB/D+AhxAeXGpYxP1OKsppIOB4rrALIDwdZ 6BtRvhsy89nElzvkwnxp7GjxGC+XHxHXT6zAhc=
  • Ironport-hdrordr: A9a23:BSMJz6Brtsbs1CTlHemK55DYdb4zR+YMi2TDgXoBMyC9Vvbo7v xG+85rsyMc6QxhP03I/OrrBEDuewK+yXcY2+ks1NSZLW3bUQmTXeNfBNDZskXd8kTFn4Y36U 4KSdkaNDSfNzlHpPe/yBWkFc0t2dyWmZrY/ts2DE0AceipUcxdBstCZTpz23cZeDV7
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Jan 20, 2023 at 06:26:14PM +0000, Andrew Cooper wrote:
> On 19/01/2023 3:22 pm, Anthony PERARD wrote:
> > `fields` and `extrafields` always all the parts of a sub-struct, so
> > when there is '}', there is always a '{' before it. Also, both are
> > lists.
> >
> > Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> > ---
> >  xen/tools/compat-xlat-header.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/xen/tools/compat-xlat-header.py 
> > b/xen/tools/compat-xlat-header.py
> > index ae5c9f11c9..d0a864b68e 100644
> > --- a/xen/tools/compat-xlat-header.py
> > +++ b/xen/tools/compat-xlat-header.py
> > @@ -105,7 +105,7 @@ def handle_field(prefix, name, id, type, fields):
> >          else:
> >              k = id.replace('.', '_')
> >              print("%sXLAT_%s_HNDL_%s(_d_, _s_);" % (prefix, name, k), 
> > end='')
> > -    elif not re_brackets.search(' '.join(fields)):
> > +    elif not '{' in fields:
> >          tag = ' '.join(fields)
> >          tag = re.sub(r'\s*(struct|union)\s+(compat_)?(\w+)\s.*', '\\3', 
> > tag)
> >          print(" \\")
> > @@ -290,7 +290,7 @@ def build_body(name, tokens):
> >      print(" \\\n} while (0)")
> >  
> >  def check_field(kind, name, field, extrafields):
> > -    if not re_brackets.search(' '.join(extrafields)):
> > +    if not '{' in extrafields:
> >          print("; \\")
> >          if len(extrafields) != 0:
> >              for token in extrafields:
> 
> These are the only two users of re_brackets aren't they?  In which case
> you should drop the re.compile() too.

Indeed, I miss that, we can drop re_brackets.

Cheers,

-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.