summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-12 05:37:38 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-12 05:37:38 +0000
commitfbcc6dea0c86e7e4d087f1d4b2de19b211d16647 (patch)
tree68bde87194755712893e5efa4d7f9d2f5312df10 /array.c
parent9d823983dc3e88cb7775c78908a4bb5133ad88ac (diff)
matz: 1.6.0 final (hopufully)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/array.c b/array.c
index e3e058fd4b..e665159ee9 100644
--- a/array.c
+++ b/array.c
@@ -355,7 +355,10 @@ rb_ary_unshift_m(argc, argv, ary)
VALUE *argv;
VALUE ary;
{
- if (argc > 0) {
+ if (argc == 0) {
+ rb_raise(rb_eArgError, "wrong # of arguments(at least 1)");
+ }
+ if (argc > 1) {
long len = RARRAY(ary)->len;
/* make rooms by setting the last item */
@@ -363,7 +366,6 @@ rb_ary_unshift_m(argc, argv, ary)
/* sliding items */
MEMMOVE(RARRAY(ary)->ptr + argc, RARRAY(ary)->ptr, VALUE, len);
-
MEMCPY(RARRAY(ary)->ptr, argv, VALUE, argc);
}
return ary;