Re: [PATCH 3/3] scripts: check-aclrules: use regular expressions less often

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

 



On Fri, Nov 22, 2019 at 11:37:31AM +0100, Ján Tomko wrote:
> On Fri, Nov 22, 2019 at 09:00:12AM +0100, Erik Skultety wrote:
> > On Wed, Nov 20, 2019 at 07:32:46PM +0100, Ján Tomko wrote:
> > > Use a simple
> > >   if "substr" in line
> > > before running a regular expression, which saves time,
> > > especially if the regex has a capture group.
> > >
> > > This reduces runtime of the check by almost 78 % for me.
> > >
> > > Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
> > > ---
> > >  scripts/check-aclrules.py | 26 +++++++++++++++++++-------
> > >  1 file changed, 19 insertions(+), 7 deletions(-)
> > ...
> >
> > >              # every func listed there, has an impl which calls
> > >              # an ACL function
> > >              if intable:
> > > -                assign = re.search(r'''\.(\w+)\s*=\s*(\w+),?''', line)
> > > +                assign = None
> > > +                if '"' in line:
> >
> > ^This doesn't quite work, does it? I don't see any '"' in the driver API
> > mapping structures. The only reliable pattern I see we could use is ', /* '
> > but in order to use that, we'd have to unify a few source files, mainly
> > vz_driver.c, doing:
> >
> > git grep -Enpi ", \s+/\* " | grep driver.c
> >
> > should help identifying them.
>
> Oops, that should've been "=".
>
> I have no idea how I managed to type that equal sign sideways. =)

I thought so, but with the pattern I suggested, you can narrow down the final
set of lines even more, so might turn out to be even faster than a plain "="

Erik

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux