diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-23 02:44:23 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-23 02:44:23 +0000 |
commit | 1bd5a8ac1a4fea1d0becc6d07c41bdd615753f28 (patch) | |
tree | 540512532df5d45b78af58881bdf879f1f2b4522 /source4/script | |
parent | 5577992f256f6fa7721872e9cd410f8814865109 (diff) | |
download | samba-1bd5a8ac1a4fea1d0becc6d07c41bdd615753f28.tar.gz samba-1bd5a8ac1a4fea1d0becc6d07c41bdd615753f28.tar.bz2 samba-1bd5a8ac1a4fea1d0becc6d07c41bdd615753f28.zip |
final bit of tidyup and speedup
(This used to be commit 1c980e6c4e89b24aa8fedf0b6684cd73f34b6c25)
Diffstat (limited to 'source4/script')
-rw-r--r-- | source4/script/mkproto.pl | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl index de8a8c3a19..c5cb374047 100644 --- a/source4/script/mkproto.pl +++ b/source4/script/mkproto.pl @@ -10,7 +10,6 @@ if ($ARGV[0] eq '-h') { $header_name = shift @ARGV; } - sub print_header { print "#ifndef $header_name\n"; print "#define $header_name\n\n"; @@ -52,46 +51,28 @@ sub handle_loadparm { sub process_file($) { my $filename = shift; - my $line; - my $inheader; - my $gotstart; open(FH, "< $filename") || die "Failed to open $filename"; - $inheader = 0; - $gotstart = 0; - print "\n/* The following definitions come from $filename */\n\n"; - while ($line = <FH>) { - # this ignores most lines + while (my $line = <FH>) { + # these are ordered for maximum speed next if ($line =~ /^\s/); - $gotstart = 0; - - if ($line =~ /^static|^extern/o || - $line !~ /^[a-zA-Z]/o || - $line =~ /[;]/o) { - next; - } - + next unless ($line =~ /\(/); + + next if ($line =~ /^\/|[;]/); + if ($line =~ /^FN_/) { handle_loadparm($line); } - next unless ($line =~ /\(/); - - if ( $line =~ / - ^void|^BOOL|^int|^struct|^char|^const|^\w+_[tT]\s|^uint|^unsigned|^long| - ^NTSTATUS|^ADS_STATUS|^enum\s.*\(|^DATA_BLOB|^WERROR|^XFILE|^FILE|^DIR| - ^double|^TDB_CONTEXT|^TDB_DATA|^TALLOC_CTX|^NTTIME - /xo) { - $gotstart = 1; - } - - - # goto next line if we don't have a start - next unless $gotstart; + next unless ( $line =~ / + ^void|^BOOL|^int|^struct|^char|^const|^\w+_[tT]\s|^uint|^unsigned|^long| + ^NTSTATUS|^ADS_STATUS|^enum\s.*\(|^DATA_BLOB|^WERROR|^XFILE|^FILE|^DIR| + ^double|^TDB_CONTEXT|^TDB_DATA|^TALLOC_CTX|^NTTIME + /xo); if ( $line =~ /\(.*\)\s*$/o ) { chomp $line; @@ -110,6 +91,8 @@ sub process_file($) print "$line\n"; } } + + close(FH); } sub process_files { |