[libvirt] [PATCH] Fix sorting of libvirt_private.syms and add syntax check rule
Eric Blake
eblake at redhat.com
Tue Dec 11 22:47:09 UTC 2012
On 12/11/2012 03:27 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at 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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121211/2a069c82/attachment-0001.sig>
More information about the libvir-list
mailing list