summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-05-10 02:58:41 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-05-10 02:58:41 +0000
commit014f2164ed7031a1c31604b290d2ab0cf1deacdc (patch)
treef3907ca91e049d42dd7cc1f4bf9b63a8aef71514
parent6f4170c2a7787ab2d6b4b302a808391317bfcbf7 (diff)
2000-05-10
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--array.c1
-rw-r--r--dln.c5
-rw-r--r--eval.c27
-rw-r--r--io.c14
-rw-r--r--sample/test.rb2
-rw-r--r--version.h4
7 files changed, 51 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 297848c..07fa720 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/array.c b/array.c
index 6793fdd..7b5ec47 100644
--- a/array.c
+++ b/array.c
@@ -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);
diff --git a/dln.c b/dln.c
index beef2f7..3a02dbf 100644
--- a/dln.c
+++ b/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,
diff --git a/eval.c b/eval.c
index faf41d1..730b82e 100644
--- a/eval.c
+++ b/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;
diff --git a/io.c b/io.c
index 5beae00..380e7d4 100644
--- a/io.c
+++ b/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;
}
diff --git a/sample/test.rb b/sample/test.rb
index 9d77647..bc97882 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -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)
diff --git a/version.h b/version.h
index e25e82e..91f9520 100644
--- a/version.h
+++ b/version.h
@@ -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