diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:35:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:35:33 +0000 |
commit | 1f641814b2bfbbf2dc3347e11a3fe901bfdf1efc (patch) | |
tree | 77094b19bf9091ceb6f6ab7d0267f70fef9c8323 /debian/tests/find_unused_functions | |
parent | Adding upstream version 2.5.13+dfsg. (diff) | |
download | openldap-1f641814b2bfbbf2dc3347e11a3fe901bfdf1efc.tar.xz openldap-1f641814b2bfbbf2dc3347e11a3fe901bfdf1efc.zip |
Adding debian version 2.5.13+dfsg-5.debian/2.5.13+dfsg-5debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | debian/tests/find_unused_functions | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/debian/tests/find_unused_functions b/debian/tests/find_unused_functions new file mode 100755 index 0000000..bd31d45 --- /dev/null +++ b/debian/tests/find_unused_functions @@ -0,0 +1,30 @@ +#! /usr/bin/perl -w + +use autouse Data::Dumper, qw{Dumper}; + +# Script to find the unused shell functions in slapd.scripts-common + +our @code; + +# Get all shell code from maintainer scripts + +foreach my $file ((<slapd.*rm>, <slapd.*inst>, <slapd.config>, + <slapd.scripts-common>)) { + open SCRIPT, "<$file" or + die "Can't open $file: $!"; + push @code, <SCRIPT>; + close SCRIPT; +} + +# Find all function declarations + +our @functions = map { /^(\w+)\s*\(\).*$/; } @code; + +# Find unused functions + +foreach $function (@functions) { + @occurences = grep /$function/, @code; + @invocations = grep { !/^$function\s*\(\)/ and !/#.*$function/ } + @occurences; + print "$function\n" if @invocations == 0; +} |