perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/util apr_arg_check.pl
Date Sun, 04 Mar 2001 23:43:36 GMT
dougm       01/03/04 15:43:36

  Added:       util     apr_arg_check.pl
  Log:
  utility for checking apr_ argument conventions
  
  Revision  Changes    Path
  1.1                  modperl-2.0/util/apr_arg_check.pl
  
  Index: apr_arg_check.pl
  ===================================================================
  use lib qw(lib);
  
  use strict;
  use Apache::FunctionTable ();
  
  #utility for checking apr_ argument conventions
  
  my $tx = '_t\s*\*+';
  
  for my $entry (@$Apache::FunctionTable) {
      my $name = $entry->{name};
      my $args = $entry->{args};
      next unless @$args and $name =~ /^apr_/;
  
      my $has_type_arg = 0;
      for my $arg (@$args) {
          my $type = $arg->{type};
          next unless $type =~ s/$tx$//o;
          $has_type_arg = $name =~ /^\Q$type/;
      }
      next unless $has_type_arg;
  
      my $i = 0;
      for my $arg (@$args) {
          $i++;
          my $type = $arg->{type};
          $type =~ s/$tx//o;
  
          if ($name =~ /^\Q$type/) {
              last if $i == 1;
          }
          else {
              next;
          }
          if ($i > 1) {
              print "'$arg->{name}' should be the first arg:\n";
                  print "   $entry->{return_type}\n   $name(",
                    (join ', ', map "$_->{type} $_->{name}", @$args),
                      ")\n\n";
          }
      }
  }
  
  
  

Mime
View raw message