diff options
author | Dylan William Hardison <dylan@hardison.net> | 2015-03-09 20:35:29 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2015-03-09 20:35:29 +0100 |
commit | 74fb163c93ccb10475f507b4b1fe7f4817990a10 (patch) | |
tree | e8a994e2439ad1220bd7996f4ad94bb32a809a5c /Bugzilla/CGI.pm | |
parent | ee27d5356f3459a8d279e3d6b7eaf9d94668f530 (diff) | |
download | bugzilla-74fb163c93ccb10475f507b4b1fe7f4817990a10.tar.gz bugzilla-74fb163c93ccb10475f507b4b1fe7f4817990a10.tar.xz |
Bug 1136125 - Reduce memory usage of Bugzilla::CGI->send_cookie()
r=dkl, a=glob
Diffstat (limited to 'Bugzilla/CGI.pm')
-rw-r--r-- | Bugzilla/CGI.pm | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 0b8a48697..fb9719547 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -426,33 +426,17 @@ 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'}) { - ThrowCodeError('cookies_need_value'); - } + ThrowCodeError('cookies_need_value') unless $paramhash{'-value'}; # Add the default path and the domain in. $paramhash{'-path'} = Bugzilla->params->{'cookiepath'}; $paramhash{'-domain'} = Bugzilla->params->{'cookiedomain'} if Bugzilla->params->{'cookiedomain'}; - # 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. |