summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-26 06:20:55 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-26 06:20:55 (GMT)
commit5fd0076871f6dedd95fdad539e9602a3d993e4a5 (patch)
treea072966159dfbddaff8aac3adff25115d2287e45 /marshal.c
parent993f22cb1bba82be52e08e7132af003ae432163e (diff)
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
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/marshal.c b/marshal.c
index 6a61ae5..43886c4 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