Skip to content

Commit

Permalink
2000-01-08
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Jan 8, 2000
1 parent a3da846 commit a69b9bc
Show file tree
Hide file tree
Showing 12 changed files with 385 additions and 368 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Fri Jan 7 00:59:29 2000 Masahiro Tomita <[email protected]>

* io.c (io_fread): TRAP_BEG/TRAP_END added around getc().

Thu Jan 6 00:39:54 2000 Yukihiro Matsumoto <[email protected]>

* random.c (rb_f_rand): should be initialized unless srand is
called before.

Wed Jan 5 02:14:46 2000 EGUCHI Osamu <[email protected]>

* parse.y: Fix SEGV on empty parens with UMINUS or UPLUS.
Expand Down
54 changes: 2 additions & 52 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,31 +292,6 @@ rb_ary_pop(ary)
return RARRAY(ary)->ptr[--RARRAY(ary)->len];
}

static VALUE
rb_ary_pop_m(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
{
int n = 1;
VALUE result;

if (argc == 0) {
return rb_ary_pop(ary);
}
if (argc > 2) {
rb_raise(rb_eArgError, "wrong # of arguments (%d for 1)", argc);
}
n = NUM2INT(argv[0]);
if (RARRAY(ary)->len < n)
n = RARRAY(ary)->len;
result = rb_ary_new2(n);
while (n--) {
rb_ary_store(result, n, rb_ary_pop(ary));
}
return result;
}

VALUE
rb_ary_shift(ary)
VALUE ary;
Expand All @@ -339,31 +314,6 @@ rb_ary_shift(ary)
return top;
}

static VALUE
rb_ary_shift_m(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
{
int n = 1;
VALUE result;

if (argc == 0) {
return rb_ary_shift(ary);
}
if (argc > 2) {
rb_raise(rb_eArgError, "wrong # of arguments (%d for 1)", argc);
}
n = NUM2INT(argv[0]);
if (RARRAY(ary)->len < n)
n = RARRAY(ary)->len;
result = rb_ary_new2(n);
while (n--) {
rb_ary_push(result, rb_ary_shift(ary));
}
return result;
}

VALUE
rb_ary_unshift(ary, item)
VALUE ary, item;
Expand Down Expand Up @@ -1600,8 +1550,8 @@ Init_Array()
rb_define_method(rb_cArray, "concat", rb_ary_concat, 1);
rb_define_method(rb_cArray, "<<", rb_ary_push, 1);
rb_define_method(rb_cArray, "push", rb_ary_push_m, -1);
rb_define_method(rb_cArray, "pop", rb_ary_pop_m, -1);
rb_define_method(rb_cArray, "shift", rb_ary_shift_m, -1);
rb_define_method(rb_cArray, "pop", rb_ary_pop, 0);
rb_define_method(rb_cArray, "shift", rb_ary_shift, 0);
rb_define_method(rb_cArray, "unshift", rb_ary_unshift, 1);
rb_define_method(rb_cArray, "each", rb_ary_each, 0);
rb_define_method(rb_cArray, "each_index", rb_ary_each_index, 0);
Expand Down
Loading

0 comments on commit a69b9bc

Please sign in to comment.