summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-02-18 01:56:47 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-02-18 01:56:47 +0000
commita9662810df18371af7492dd8298cc0cccc13c7c7 (patch)
tree5a1131ad0ca461f67177e1c7282eacc92356f864 /array.c
parent14aa2e8dda852b6b9277a8a7e16a78654edf1767 (diff)
1.1b8pre1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@76 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/array.c b/array.c
index e39f1f1..9ef50cf 100644
--- a/array.c
+++ b/array.c
@@ -115,7 +115,12 @@ ary_new4(n, elts)
VALUE ary;
ary = ary_new2(n);
- MEMCPY(RARRAY(ary)->ptr, elts, VALUE, n);
+ if (elts) {
+ MEMCPY(RARRAY(ary)->ptr, elts, VALUE, n);
+ }
+ else {
+ memclear(RARRAY(ary)->ptr, n);
+ }
RARRAY(ary)->len = n;
return ary;
@@ -136,14 +141,14 @@ assoc_new(car, cdr)
}
static VALUE
-ary_s_new(argc, argv, class)
+ary_s_new(argc, argv, klass)
int argc;
VALUE *argv;
- VALUE class;
+ VALUE klass;
{
VALUE size;
NEWOBJ(ary, struct RArray);
- OBJSETUP(ary, class, T_ARRAY);
+ OBJSETUP(ary, klass, T_ARRAY);
rb_scan_args(argc, argv, "01", &size);
ary->len = 0;
@@ -155,13 +160,13 @@ ary_s_new(argc, argv, class)
}
static VALUE
-ary_s_create(argc, argv, class)
+ary_s_create(argc, argv, klass)
int argc;
VALUE *argv;
- VALUE class;
+ VALUE klass;
{
NEWOBJ(ary, struct RArray);
- OBJSETUP(ary, class, T_ARRAY);
+ OBJSETUP(ary, klass, T_ARRAY);
ary->len = argc;
ary->capa = argc;