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

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



On 12/11/2012 03:27 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> 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 redhat com>
> ---
>  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...

> +            }
> +            @group = ();
> +            $line = $.;
> +        } else {
> +            $_ =~ s/;//;
> +            push @group, $_;
> +        }
> +    }
> +
> +    close SYMFILE;
> +    if (@group) {
> +        &check_sorting(\ group, $symfile, $line);
> +    }
> +}
> +
> +sub check_sorting {

...that is defined later in the file.  I would have swapped the main
loop to come after the 'sub', but not a show-stopper.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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