git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-05-10 02:58:41 +00:00
Родитель 6f4170c2a7
Коммит 014f2164ed
7 изменённых файлов: 51 добавлений и 13 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Tue May 9 17:08:43 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* array.c (Init_Array): prepare 'append' as alias to `push'.
* eval.c (massign): no longer convert nil into empty array.
* io.c (rb_io_s_popen): optional 3rd argument to give proc, which
will be executed in spawned child process.
Mon May 8 23:47:39 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
* eval.c (rb_callcc): prev & next should be initialized to zero.
@ -5,7 +14,7 @@ Mon May 8 23:47:39 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
Mon May 8 23:17:36 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* dln.c (dln_init): remove possible buffer overrun. This is
suggested by Aleksi Niemela <aleksi.niemela@cinnober.com>
suggested by Aleksi Niemela <aleksi.niemela@cinnober.com>.
* dln.c (init_funcname): ditto.

Просмотреть файл

@ -1601,6 +1601,7 @@ Init_Array()
rb_define_method(rb_cArray, "last", rb_ary_last, 0);
rb_define_method(rb_cArray, "concat", rb_ary_concat, 1);
rb_define_method(rb_cArray, "<<", rb_ary_push, 1);
rb_define_method(rb_cArray, "append", rb_ary_push_m, -1);
rb_define_method(rb_cArray, "push", rb_ary_push_m, -1);
rb_define_method(rb_cArray, "pop", rb_ary_pop, 0);
rb_define_method(rb_cArray, "shift", rb_ary_shift, 0);

5
dln.c
Просмотреть файл

@ -1211,10 +1211,12 @@ dln_load(file)
{
#ifdef _WIN32
HINSTANCE handle;
char winfile[255];
char winfile[MAXPATHLEN];
void (*init_fct)();
char buf[MAXPATHLEN];
if (strlen(file) >= MAXPATHLEN) rb_loaderror("filename too long");
/* Load the file as an object one */
init_funcname(buf, file);
@ -1421,6 +1423,7 @@ dln_load(file)
if (err_stat != B_NO_ERROR) {
char real_name[MAXPATHLEN];
strcpy(real_name, buf);
strcat(real_name, "__Fv");
err_stat = get_image_symbol(img_id, real_name,

27
eval.c
Просмотреть файл

@ -3437,10 +3437,14 @@ massign(self, node, val, check)
list = node->nd_head;
if (TYPE(val) != T_ARRAY) {
#if 0
if (!check && NIL_P(val))
val = rb_ary_new2(0);
else
val = rb_ary_new3(1, val);
#else
val = rb_ary_new3(1, val);
#endif
}
len = RARRAY(val)->len;
for (i=0; list && i<len; i++) {
@ -4636,7 +4640,12 @@ eval_under(under, self, src, file, line)
{
VALUE args[4];
Check_SafeStr(src);
if (ruby_safe_level >= 4) {
Check_Type(src, T_STRING);
}
else {
Check_SafeStr(src);
}
args[0] = self;
args[1] = src;
args[2] = (VALUE)file;
@ -6632,6 +6641,7 @@ rb_thread_schedule()
thread_t next; /* OK */
thread_t th;
thread_t curr;
int found = 0;
select_err:
rb_thread_pending = 0;
@ -6646,6 +6656,14 @@ rb_thread_schedule()
curr = curr->prev;
}
FOREACH_THREAD_FROM(curr, th) {
if (th->status == THREAD_RUNNABLE || th->status == THREAD_TO_KILL) {
found = 1;
break;
}
}
END_FOREACH_FROM(curr, th);
if (num_waiting_on_join) {
FOREACH_THREAD_FROM(curr, th) {
if ((th->wait_for&WAIT_JOIN) && rb_thread_dead(th->join)) {
@ -6653,6 +6671,7 @@ rb_thread_schedule()
th->wait_for &= ~WAIT_JOIN;
th->status = THREAD_RUNNABLE;
num_waiting_on_join--;
found = 1;
}
}
END_FOREACH_FROM(curr, th);
@ -6662,7 +6681,7 @@ rb_thread_schedule()
fd_set readfds;
struct timeval delay_tv, *delay_ptr;
double delay, now; /* OK */
int n, max, found;
int n, max;
do {
max = 0;
@ -6765,13 +6784,11 @@ rb_thread_schedule()
th->thread, th->status,
th->wait_for, th==main_thread?"(main)":"",
th->file, th->line);
if (th->status == THREAD_STOPPED) {
next = th;
}
}
END_FOREACH_FROM(curr, th);
/* raise fatal error to main thread */
rb_thread_deadlock();
next = main_thread;
rb_thread_ready(next);
next->gid = 0;
next->status = THREAD_TO_KILL;

14
io.c
Просмотреть файл

@ -1557,9 +1557,9 @@ rb_io_s_popen(argc, argv, self)
VALUE self;
{
char *mode;
VALUE pname, pmode, port;
VALUE pname, pmode, port, proc;
if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) {
if (rb_scan_args(argc, argv, "12", &pname, &pmode, &proc) == 1) {
mode = "r";
}
else {
@ -1573,7 +1573,12 @@ rb_io_s_popen(argc, argv, self)
Check_SafeStr(pname);
port = pipe_open(RSTRING(pname)->ptr, mode);
if (NIL_P(port)) {
rb_yield(port);
if (!NIL_P(proc)) {
rb_eval_cmd(proc, rb_ary_new2(0));
}
else {
rb_yield(port);
}
}
else if (rb_iterator_p()) {
return rb_ensure(rb_yield, port, rb_io_close, port);
@ -2275,6 +2280,9 @@ rb_io_initialize(argc, argv, io)
fp->f = rb_fdopen(NUM2INT(fnum), m);
fp->mode = rb_io_mode_flags(m);
if (rb_iterator_p()) {
return rb_ensure(rb_yield, io, rb_io_close, io);
}
return io;
}

Просмотреть файл

@ -726,7 +726,7 @@ ok(a == [1, 2, 3])
ok(a == [4])
*a = nil
ok(a == [])
ok(a == [nil])
check "call"
def aaa(a, b=100, *rest)

Просмотреть файл

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.3"
#define RUBY_RELEASE_DATE "2000-05-09"
#define RUBY_RELEASE_DATE "2000-05-10"
#define RUBY_VERSION_CODE 153
#define RUBY_RELEASE_CODE 20000509
#define RUBY_RELEASE_CODE 20000510