phash: move sample function to the sample file
authorH. Peter Anvin <hpa@linux.intel.com>
Wed, 22 Sep 2010 21:02:28 +0000 (14:02 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Wed, 22 Sep 2010 21:02:28 +0000 (14:02 -0700)
read_input() shouldn't be part of the phash.ph module; instead it
should go into the sample usage file phash.pl.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
perllib/phash.ph
phash.pl

index 6b31f0a..5bc2744 100644 (file)
@@ -170,32 +170,6 @@ sub gen_perfect_hash($) {
 }
 
 #
-# Read input file
-#
-sub read_input() {
-    my $key,$val;
-    my %out;
-    my $x = 0;
-
-    while (defined($l = <STDIN>)) {
-       chomp $l;
-       $l =~ s/\s*(\#.*|)$//;
-
-       next if ($l eq '');
-
-       if ($l =~ /^([^=]+)\=([^=]+)$/) {
-           $out{$1} = $2;
-           $x = $2;
-       } else {
-           $out{$l} = $x;
-       }
-       $x++;
-    }
-
-    return %out;
-}
-
-#
 # Verify that the hash table is actually correct...
 #
 sub verify_hash_table($$)
index e1071b2..cc9ca74 100755 (executable)
--- a/phash.pl
+++ b/phash.pl
 require 'phash.ph';
 
 #
+# Read input file
+#
+sub read_input() {
+    my $key,$val;
+    my %out;
+    my $x = 0;
+
+    while (defined($l = <STDIN>)) {
+       chomp $l;
+       $l =~ s/\s*(\#.*|)$//;
+
+       next if ($l eq '');
+
+       if ($l =~ /^([^=]+)\=([^=]+)$/) {
+           $out{$1} = $2;
+           $x = $2;
+       } else {
+           $out{$l} = $x;
+       }
+       $x++;
+    }
+
+    return %out;
+}
+
+#
 # Main program
 #
 sub main() {