* [PATCH] stream_input: favor String#clear over String#replace
@ 2015-08-22 4:42 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2015-08-22 4:42 UTC (permalink / raw)
To: unicorn-public
We no longer need Ruby 1.8 compatibility, so use String#clear
to reduce argument passing and code size.
---
lib/unicorn/stream_input.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/unicorn/stream_input.rb b/lib/unicorn/stream_input.rb
index 9278f47..de5aeea 100644
--- a/lib/unicorn/stream_input.rb
+++ b/lib/unicorn/stream_input.rb
@@ -53,7 +53,7 @@ class Unicorn::StreamInput
rv << @rbuf
to_read -= @rbuf.size
end
- @rbuf.replace('')
+ @rbuf.clear
end
rv = nil if rv.empty? && length != 0
else
@@ -130,8 +130,8 @@ private
filter_body(@rbuf, @buf)
dst << @rbuf
end
- ensure
- @rbuf.replace('')
+ ensure
+ @rbuf.clear
end
def eof!
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-08-22 4:42 7% [PATCH] stream_input: favor String#clear over String#replace Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).