summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-13 08:19:09 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-13 08:19:09 +0000
commitd8c75ddad376abf83a4d6dd9d4c8eb1736db497c (patch)
tree12ebace8954f29cfbc70bc55800cfa1e01dcc5b0 /array.c
parenta59c599209a11d4ab0dc0d7626ab3d5ca43a78c2 (diff)
* time.c (time_new_internal): avoid loop to calculate negative
div, mod. * time.c (time_cmp): should handle Bignums. * array.c (rb_ary_pop): should ELTS_SHARED flag check before REALLOC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/array.c b/array.c
index c9b66eb..b58f484 100644
--- a/array.c
+++ b/array.c
@@ -336,7 +336,9 @@ rb_ary_pop(ary)
{
rb_ary_modify_check(ary);
if (RARRAY(ary)->len == 0) return Qnil;
- if (RARRAY(ary)->len * 10 < RARRAY(ary)->aux.capa && RARRAY(ary)->aux.capa > ARY_DEFAULT_SIZE) {
+ if (!FL_TEST(ary, ELTS_SHARED) &&
+ RARRAY(ary)->len * 10 < RARRAY(ary)->aux.capa &&
+ RARRAY(ary)->aux.capa > ARY_DEFAULT_SIZE) {
RARRAY(ary)->aux.capa = RARRAY(ary)->len * 2;
REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa);
}