From b36c4ef40718e469d5924721cee4ef15b1a1bf64 Mon Sep 17 00:00:00 2001 From: "jocuri%softhome.net" <> Date: Sun, 16 Jan 2005 21:02:34 +0000 Subject: Patch for bug 277622: Move DiffStrings() out of globals.pl into Bugzilla/Util.pm; patch by Max K-A , r=vladd, a=myk. --- globals.pl | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'globals.pl') diff --git a/globals.pl b/globals.pl index 5f599146f..81b99c8ac 100644 --- a/globals.pl +++ b/globals.pl @@ -1442,35 +1442,6 @@ sub RemoveVotes { } } -# Take two comma or space separated strings and return what -# values were removed from or added to the new one. -sub DiffStrings { - my ($oldstr, $newstr) = @_; - - # Split the old and new strings into arrays containing their values. - $oldstr =~ s/[\s,]+/ /g; - $newstr =~ s/[\s,]+/ /g; - my @old = split(" ", $oldstr); - my @new = split(" ", $newstr); - - # For each pair of (old, new) entries: - # If they're equal, set them to empty. When done, @old contains entries - # that were removed; @new contains ones that got added. - - foreach my $oldv (@old) { - foreach my $newv (@new) { - next if ($newv eq ''); - if ($oldv eq $newv) { - $newv = $oldv = ''; - } - } - } - my $removed = join (", ", grep { $_ ne '' } @old); - my $added = join (", ", grep { $_ ne '' } @new); - - return ($removed, $added); -} - sub PerformSubsts { my ($str, $substs) = (@_); $str =~ s/%([a-z]*)%/(defined $substs->{$1} ? $substs->{$1} : Param($1))/eg; -- cgit v1.2.3-24-g4f1b