Skip to content

Commit

Permalink
[backend] BSHTTP::read_data: save some memory
Browse files Browse the repository at this point in the history
Do not create a copy of the data we read.
  • Loading branch information
mlschroe committed May 23, 2024
1 parent a0ec8f4 commit 8da03a3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/backend/BSHTTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,11 @@ sub read_data {
$cl = $maxl = length($qu);
}
}
$cl -= $maxl if defined($cl);
$ret = substr($qu, 0, $maxl);
$cl -= $maxl if defined $cl;
$req->{'__cl'} = $cl;
$req->{'__data'} = substr($qu, $maxl);
$req->{'__data'} = substr($qu, $maxl, length($qu) - $maxl, '');
$req->{'__eof'} = 1 if defined($cl) && $cl == 0;
return $ret;
return $qu;
}
}

Expand Down

0 comments on commit 8da03a3

Please sign in to comment.