* [ANN] yahns 1.4.0 - minor internal cleanups and bugfixes
@ 2014-11-16 11:13 5% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2014-11-16 11:13 UTC (permalink / raw)
To: yahns-public
- http_client: clear some internal ivars on rack.hijack
- README: minor updates
- extras/autoindex: do not link beyond top-level
- extras/autoindex: fix misnamed variable
- extras/autoindex: integrate with TryGzipStatic
- queue: remove TODO comment for kqueue
- switch to require_relative for internal requires
- README: add OpenSSL exception
- stream_input: favor str.clear instead of str.replace('')
- http_response: skip Date header case-insensitively
* git clone git://yhbt.net/yahns
* http://yahns.yhbt.net/README
* http://yahns.yhbt.net/NEWS.atom.xml
* yahns-public@yhbt.net
^ permalink raw reply [relevance 5%]
* [PATCH] stream_input: favor str.clear instead of str.replace('')
@ 2014-10-18 11:02 7% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2014-10-18 11:02 UTC (permalink / raw)
To: yahns-public
String#clear has a simpler dispatch and requires no object
allocation. The only reason we used String#replace before
was because it was inherited from a Ruby 1.8-compatible
project where String#clear was not available.
---
lib/yahns/stream_input.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/yahns/stream_input.rb b/lib/yahns/stream_input.rb
index eea3a0a..d32ff66 100644
--- a/lib/yahns/stream_input.rb
+++ b/lib/yahns/stream_input.rb
@@ -50,7 +50,7 @@ class Yahns::StreamInput # :nodoc:
rv << @rbuf
to_read -= @rbuf.size
end
- @rbuf.replace('')
+ @rbuf.clear
end
rv = nil if rv.empty? && length != 0
else
@@ -137,7 +137,7 @@ class Yahns::StreamInput # :nodoc:
dst << @rbuf
end
ensure
- @rbuf.replace('')
+ @rbuf.clear
end
def eof!
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-10-18 11:02 7% [PATCH] stream_input: favor str.clear instead of str.replace('') Eric Wong
2014-11-16 11:13 5% [ANN] yahns 1.4.0 - minor internal cleanups and bugfixes Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/yahns.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).