summaryrefslogtreecommitdiff
path: root/ext/-test-
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-09 05:53:00 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-09 05:53:00 +0000
commit837392b45260785a8ccc13aceba5be90e067a974 (patch)
tree047e5d63437c4e2f439dd991d1c76ae8da98520d /ext/-test-
parentf6757f080c9201de6fbd1d25b663c37341ef2305 (diff)
* bignum.c (rb_integer_pack): numwords_allocated argument removed.
* internal.h (rb_integer_pack): Follow the above change. * hash.c (rb_hash): Ditto. * time.c (v2w_bignum): Ditto. * pack.c (pack_pack): Ditto. * random.c (int_pair_to_real_inclusive): Ditto. (rand_init): Ditto. (random_load): Ditto. (limited_big_rand): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/-test-')
-rw-r--r--ext/-test-/bignum/pack.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/ext/-test-/bignum/pack.c b/ext/-test-/bignum/pack.c
index 34c7a47..8634e1e 100644
--- a/ext/-test-/bignum/pack.c
+++ b/ext/-test-/bignum/pack.c
@@ -9,14 +9,11 @@ rb_integer_pack_m(VALUE val, VALUE buf, VALUE wordsize_arg, VALUE nails, VALUE f
void *ret;
size_t wordsize = NUM2SIZET(wordsize_arg);
- if (!NIL_P(buf)) {
- StringValue(buf);
- rb_str_modify(buf);
- count = RSTRING_LEN(buf) / wordsize;
- }
-
+ StringValue(buf);
+ rb_str_modify(buf);
+ count = wordsize == 0 ? 0 : RSTRING_LEN(buf) / wordsize;
ret = rb_integer_pack(val,
- &sign, &count, NIL_P(buf) ? NULL : RSTRING_PTR(buf), count,
+ &sign, RSTRING_PTR(buf), count,
wordsize, NUM2SIZET(nails), NUM2INT(flags));
return rb_ary_new_from_args(3, INT2NUM(sign), ret ? rb_str_new(ret, wordsize * count) : Qnil, SIZET2NUM(count));