diff options
author | jocuri%softhome.net <> | 2005-01-16 22:02:34 +0100 |
---|---|---|
committer | jocuri%softhome.net <> | 2005-01-16 22:02:34 +0100 |
commit | b36c4ef40718e469d5924721cee4ef15b1a1bf64 (patch) | |
tree | 1c90b2bdd839ee6117458d9d555c09743524a2f8 /globals.pl | |
parent | ba11a24ba069e190fa161abf366a1282f4a0b5a2 (diff) | |
download | bugzilla-b36c4ef40718e469d5924721cee4ef15b1a1bf64.tar.gz bugzilla-b36c4ef40718e469d5924721cee4ef15b1a1bf64.tar.xz |
Patch for bug 277622: Move DiffStrings() out of globals.pl into Bugzilla/Util.pm; patch by Max K-A <mkanat@kerio.com>, r=vladd, a=myk.
Diffstat (limited to 'globals.pl')
-rw-r--r-- | globals.pl | 29 |
1 files changed, 0 insertions, 29 deletions
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; |