[Pkg-openldap-devel] [openldap] 08/17: r1754 at pulsar: torsten | 2005-04-17 10:41:22 +0200 Added a perl script to find unused functions in shell code.

Timo Aaltonen tjaalton-guest at alioth.debian.org
Thu Oct 10 05:35:32 UTC 2013


This is an automated email from the git hooks/post-receive script.

tjaalton-guest pushed a commit to annotated tag 2.2.23-3
in repository openldap.

commit 0c8df26fc54453b230785154ce0dddd83ca3ac2a
Author: Torsten Landschoff <torsten at debian.org>
Date:   Sun Apr 17 08:59:49 2005 +0000

     r1754 at pulsar:  torsten | 2005-04-17 10:41:22 +0200
     Added a perl script to find unused functions in shell code.
---
 debian/tests/find_unused_functions |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/debian/tests/find_unused_functions b/debian/tests/find_unused_functions
new file mode 100644
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;
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-openldap/openldap.git



More information about the Pkg-openldap-devel mailing list