From 741c0772bf49e348fe0e2ea00a8937512b03d074 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 17 Apr 2012 15:59:44 +0200 Subject: [PATCH] Refactor autodoc.pl to read MANIFEST line by line, instead of slurping it. --- autodoc.pl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/autodoc.pl b/autodoc.pl index d243592..f82593e 100644 --- a/autodoc.pl +++ b/autodoc.pl @@ -325,21 +325,19 @@ foreach (@{(setup_embed())[0]}) { }; } -my $file; # glob() picks up docs from extra .c or .h files that may be in unclean # development trees. -my $MANIFEST = do { - local ($/, *FH); - open FH, "MANIFEST" or die "Can't open MANIFEST: $!"; - ; -}; +open my $fh, '<', 'MANIFEST' + or die "Can't open MANIFEST: $!"; +while (my $line = <$fh>) { + next unless my ($file) = $line =~ /^(\S+\.[ch])\t/; -for $file (($MANIFEST =~ /^(\S+\.c)\t/gm), ($MANIFEST =~ /^(\S+\.h)\t/gm)) { open F, "< $file" or die "Cannot open $file for docs: $!\n"; $curheader = "Functions in file $file\n"; autodoc(\*F,$file); close F or die "Error closing $file: $!\n"; } +close $fh or die "Error whilst reading MANIFEST: $!"; for (sort keys %funcflags) { next unless $funcflags{$_}{flags} =~ /d/; -- 2.7.4