On Mar 14, 2008, at 5:36 AM, Torsten Foertsch wrote:

On Tue 19 Feb 2008, Torsten Foertsch wrote:
support/list_hooks.pl does not parse declarations that span multiple lines.
The attached version does. See also bug #44453.

Please take this mail as a polite reminder since nobody has answered this
patch for almost a month now.

I understand support/list_hooks.pl is not the most important part of httpd but
it is included in the shipped package. So, why don't we make it work?


FWIW, here is the patch... I will test and trace and
assuming it goes well, will commit.


@@ -1,4 +1,5 @@
 #!/usr/bin/perl -w
+# -*- mode:cperl;cperl-indent-level:4;cperl-continued-statement- offset:4;indent-tabs-mode:nil -*-
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -36,6 +37,8 @@
     print "\n";
 }

+#warn "found ".keys(%::Hooks)." hooks\n";
+
 sub findInDir {
     my $path=shift;

@@ -65,32 +68,31 @@
     while(<F>) {
        next if /\#define/;
        next if /[EMAIL PROTECTED]/;
-       if(/AP_DECLARE_HOOK\((.*)\)/) {
-           my $def=$1;
- my($ret,$name,$args)=$def=~/([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*\ ((.*)\)/;
-           croak "Don't understand $def in $file" if !defined $args;
-#          print "found $ret $name($args) in $file\n";
-
-           croak "$name declared twice! ($_)"
-               if exists $::Hooks{$name}->{declared};
-           $::Hooks{$name}->{declared}=$file;
-           $::Hooks{$name}->{ret}=$ret;
-           $::Hooks{$name}->{args}=$args;
-       } elsif(/AP_DECLARE_HOOK\((\s*[^,\s]+)\s*,\s*([^,\s]+)/) {
-# really we should swallow subsequent lines to get the arguments...
-           my $name=$2;
-           my $ret=$1;
-           croak "$name declared twice! ($_)"
-               if exists $::Hooks{$name}->{declared};
-           $::Hooks{$name}->{declared}=$file;
-           $::Hooks{$name}->{ret}=$ret;
-           $::Hooks{$name}->{args}='???';
+       if(/AP_DECLARE_HOOK\s*\(/) {
+            my($ret,$name,$args);
+            while(!(($ret,$name,$args)=
+ /AP_DECLARE_HOOK\s*\(\s*([^,]+)\s*,\s*([^,\s]+) \s*,\s*\((.*?)\)\)/s)) {
+                chomp;
+                my $l=<F>;
+                return unless defined $l;
+                $l=~s/^\s*/ /;
+                $_.=$l;
+            }
+            $ret=~s/\s*$//;
+            $args=~s/^\s*//; $args=~s/\s*$//;
+#            warn "found $ret $name($args) in $file\n";
+
+            croak "$name declared twice! ($_)"
+                if exists $::Hooks{$name}->{declared};
+            $::Hooks{$name}->{declared}=$file;
+            $::Hooks{$name}->{ret}=$ret;
+            $::Hooks{$name}->{args}=$args;
        }
        if(/AP_IMPLEMENT_HOOK_()(VOID)\(([^,\s]+)/
|| /AP_IMPLEMENT(_OPTIONAL|)_HOOK_(.*?)\([^,]+?\s*,\s*([^,\s] +)/) {
            my($type,$name)=($1 ? "OPTIONAL $2" : $2,$3);

-#          print "found $name $type in $file\n";
+#            warn "found $name $type in $file\n";

croak "$name implemented twice ($::Hooks{$name}->{implemented} and $file) ($_)"
                if exists $::Hooks{$name}->{implemented};


Reply via email to