summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-12 03:00:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-12 03:00:17 +0000
commit6ff25d132de8676d6df5b4f70508a2adfdb55e45 (patch)
treea18b309891fdfb6649ae67ef3800bc55b54614b9 /array.c
parenta5acd8c8d3a1b5446e377db2c82a2eb483ebe89c (diff)
array.c: assertion
* array.c (ary_shrink_capa): additional assertion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/array.c b/array.c
index eed646b..e8920c0 100644
--- a/array.c
+++ b/array.c
@@ -179,11 +179,12 @@ ary_resize_capa(VALUE ary, long capacity)
}
}
-static void
+static inline void
ary_shrink_capa(VALUE ary)
{
long capacity = ARY_HEAP_LEN(ary);
long old_capa = RARRAY(ary)->as.heap.aux.capa;
+ assert(!ARY_SHARED_P(ary));
assert(old_capa >= capacity);
if (old_capa > capacity)
REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, capacity);