From 5fd0076871f6dedd95fdad539e9602a3d993e4a5 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 26 Dec 2014 06:20:55 +0000 Subject: [PATCH] marshal.c: append at once * marshal.c (w_long): append at once by w_nbyte() instead of appending byte by byte. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ marshal.c | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f6e6675b7..2acd0c8ff0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Dec 26 15:20:54 2014 Nobuyoshi Nakada + + * marshal.c (w_long): append at once by w_nbyte() instead of + appending byte by byte. + Fri Dec 26 15:13:13 2014 Nobuyoshi Nakada * ext/json/parser/parser.rl (unescape_unicode): check if valid diff --git a/marshal.c b/marshal.c index 6a61ae53b4..43886c4daa 100644 --- a/marshal.c +++ b/marshal.c @@ -277,7 +277,7 @@ static void w_long(long x, struct dump_arg *arg) { char buf[sizeof(long)+1]; - int i, len = 0; + int i; #if SIZEOF_LONG > 4 if (!(RSHIFT(x, 31) == 0 || RSHIFT(x, 31) == -1)) { @@ -310,10 +310,7 @@ w_long(long x, struct dump_arg *arg) break; } } - len = i; - for (i=0;i<=len;i++) { - w_byte(buf[i], arg); - } + w_nbyte(buf, i+1, arg); } #ifdef DBL_MANT_DIG