Re: [PATCH] Fix sorting of libvirt_private.syms and add syntax check rule

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

 



On Tue, Dec 11, 2012 at 03:47:09PM -0700, Eric Blake wrote:
> On 12/11/2012 03:27 PM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> > 
> > Add check-symsorting.pl to perform case-insensitive alphabetical
> > sorting of groups of symbols. Fix all violations it reports
> > 
> > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> > ---
> >  src/Makefile.am          |   4 +-
> >  src/check-symsorting.pl  |  66 +++++++++++++++++++
> >  src/libvirt_esx.syms     |   2 +-
> >  src/libvirt_openvz.syms  |   2 +-
> >  src/libvirt_private.syms | 161 ++++++++++++++++++++++++-----------------------
> >  5 files changed, 152 insertions(+), 83 deletions(-)
> >  create mode 100644 src/check-symsorting.pl
> > 
> 
> > diff --git a/src/check-symsorting.pl b/src/check-symsorting.pl
> > new file mode 100644
> 
> chmod +x
> 
> > index 0000000..9c62246
> > --- /dev/null
> > +++ b/src/check-symsorting.pl
> > @@ -0,0 +1,66 @@
> > +#!/usr/bin/perl
> > +
> > +use strict;
> > +use warnings;
> > +
> > +die "syntax: $0 SYMFILE..." unless int(@ARGV) >= 1;
> > +
> > +my $ret = 0;
> > +foreach my $symfile (@ARGV) {
> > +    open SYMFILE, $symfile or die "cannot read $symfile: $!";
> > +
> > +    my $line;
> > +    my @group;
> > +
> > +    while (<SYMFILE>) {
> > +        chomp;
> > +        next if /^#/;
> > +
> > +        if (/^\s*$/) {
> > +            if (@group) {
> > +                &check_sorting(\@group, $symfile, $line);
> 
> So perl lets you call a function...

Yes, the key here is the '&' symbol, since we've not predeclared
the function

[perlsub(1)]
       A subroutine may be called using an explicit "&" prefix.  The "&" is
       optional in modern Perl, as are parentheses if the subroutine has
       been predeclared.  The "&" is not optional when just naming the
       subroutine, such as when it's used as an argument to defined() or
       undef().  Nor is it optional when you want to do an indirect
       subroutine call with a subroutine name or reference using the
       "&$subref()" or "&{$subref}()" constructs, although the
       "$subref->()" notation solves that problem.  See perlref for more
       about all that.
[/perlsub]


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
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]