]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Backport 1136125 to bmo - Reduce memory usage of Bugzilla::CGI->send_cookie()
authorDylan William Hardison <dylan@hardison.net>
Mon, 5 Mar 2018 04:56:39 +0000 (23:56 -0500)
committerGitHub <noreply@github.com>
Mon, 5 Mar 2018 04:56:39 +0000 (23:56 -0500)
Bugzilla/CGI.pm

index 41b418f6a4275b04cafda1ae3942c9928d1d1365..3906156c4dbb6709838c48421d69d805bf198e8a 100644 (file)
@@ -661,16 +661,7 @@ sub should_set {
 # pass them around to all of the callers. Instead, store them locally here,
 # and then output as required from |header|.
 sub send_cookie {
-    my $self = shift;
-
-    # Move the param list into a hash for easier handling.
-    my %paramhash;
-    my @paramlist;
-    my ($key, $value);
-    while ($key = shift) {
-        $value = shift;
-        $paramhash{$key} = $value;
-    }
+    my ($self, %paramhash) = @_;
 
     # Complain if -value is not given or empty (bug 268146).
     if (!exists($paramhash{'-value'}) || !$paramhash{'-value'}) {
@@ -684,13 +675,7 @@ sub send_cookie {
     $paramhash{'-secure'} = 1
       if lc( $uri->scheme ) eq 'https';
 
-
-    # Move the param list back into an array for the call to cookie().
-    foreach (keys(%paramhash)) {
-        unshift(@paramlist, $_ => $paramhash{$_});
-    }
-
-    push(@{$self->{'Bugzilla_cookie_list'}}, $self->cookie(@paramlist));
+    push(@{$self->{'Bugzilla_cookie_list'}}, $self->cookie(%paramhash));
 }
 
 # Cookies are removed by setting an expiry date in the past.