yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] config: avoid unnecessary binmode call
@ 2015-04-22  0:59 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-04-22  0:59 UTC (permalink / raw)
  To: yahns-public; +Cc: Eric Wong

We may set binary mode upon open by passing "b" in the mode string,
so avoid the extra method dispatch and bytecode/cache overhead that
entails.
---
 lib/yahns/config.rb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb
index 9db0d59..f4164a9 100644
--- a/lib/yahns/config.rb
+++ b/lib/yahns/config.rb
@@ -400,9 +400,8 @@ def errors(val)
     var = _check_in_block(:app, :errors)
     if String === val
       # we've already bound working_directory by the time we get here
-      val = File.open(File.expand_path(val), "a")
+      val = File.open(File.expand_path(val), "ab")
       val.close_on_exec = val.sync = true
-      val.binmode
     else
       rt = [ :puts, :write, :flush ] # match Rack::Lint
       rt.all? { |m| val.respond_to?(m) } or raise ArgumentError,
-- 
2.3.2.465.ga3b75b3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-22  0:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-22  0:59 [PATCH] config: avoid unnecessary binmode call 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).