kcar RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] parser: shorten condition statement
@ 2015-03-16 20:15 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-03-16 20:15 UTC (permalink / raw)
  To: kcar-public

This saves 16 bytes on x86-64 (Ruby trunk r49982)
---
 lib/kcar/parser.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/kcar/parser.rb b/lib/kcar/parser.rb
index 4dd59e2..64fb43b 100644
--- a/lib/kcar/parser.rb
+++ b/lib/kcar/parser.rb
@@ -19,7 +19,7 @@ def extract_trailers(hdr)
           value.split(/\s*,+\s*/).each do |k|
             t[k] = true
           end
-        elsif false == t.empty? && key =~ /\A(#{t.keys.join('|')})\z/i
+        elsif !t.empty? && key =~ /\A(#{t.keys.join('|')})\z/i
           k = $1
           trailers.concat(value.split(/\n+/).map! { |v| [ k, v ] })
         end
-- 
EW


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

only message in thread, other threads:[~2015-03-16 20:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-16 20:15 [PATCH] parser: shorten condition statement Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/kcar.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).