1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (str_new): need no MEMZERO().

* numeric.c (fix_gt): use rb_num_coerce_cmp() instead of
  rb_num_coerce_bin.

* numeric.c (fix_ge, fix_lt, fix_le): ditto.

* numeric.c (flo_gt, flo_ge, flo_lt, flo_le): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-02-27 08:04:32 +00:00
parent 780e1aa291
commit e5c5576aeb
5 changed files with 69 additions and 38 deletions

View file

@ -7,11 +7,24 @@ Tue Feb 25 23:03:08 2003 NAKAMURA Hiroshi <nahi@ruby-lang.org>
* lib/debug.rb (DEBUGGER__::Context#debug_command): bp filename must * lib/debug.rb (DEBUGGER__::Context#debug_command): bp filename must
be the basename of it. [ruby-talk:65644] be the basename of it. [ruby-talk:65644]
Mon Feb 24 08:06:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (str_new): need no MEMZERO().
Sun Feb 23 17:57:06 2003 WATANABE Hirofumi <eban@ruby-lang.org> Sun Feb 23 17:57:06 2003 WATANABE Hirofumi <eban@ruby-lang.org>
* lib/fileutils (fu_stream_blksize): wrong logial condition. * lib/fileutils (fu_stream_blksize): wrong logial condition.
(and -> or). (and -> or).
Sat Feb 22 03:12:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* numeric.c (fix_gt): use rb_num_coerce_cmp() instead of
rb_num_coerce_bin.
* numeric.c (fix_ge, fix_lt, fix_le): ditto.
* numeric.c (flo_gt, flo_ge, flo_lt, flo_le): ditto.
Sat Feb 22 02:45:20 2003 Yukihiro Matsumoto <matz@ruby-lang.org> Sat Feb 22 02:45:20 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_thread_create): may called from place higher than * eval.c (rb_thread_create): may called from place higher than
@ -57,9 +70,7 @@ Fri Feb 21 05:16:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* compar.c (cmp_gt): return nil if "<=>" returns nil (means * compar.c (cmp_gt): return nil if "<=>" returns nil (means
incomparable). incomparable).
* compar.c (cmp_ge): ditto. * compar.c (cmp_ge, cmp_lt, cmp_le): ditto.
* compar.c (cmp_lt): ditto.
* compar.c (cmp_between): use RTEST(), since cmp_lt and cmp_gt may * compar.c (cmp_between): use RTEST(), since cmp_lt and cmp_gt may
return nil. return nil.
@ -102,9 +113,7 @@ Thu Feb 20 04:07:06 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* eval.c (is_defined): private "[]=" and "foo=" support. * eval.c (is_defined): private "[]=" and "foo=" support.
* eval.c (rb_eval): ditto. * eval.c (rb_eval, assign): ditto.
* eval.c (assign): ditto.
Thu Feb 20 03:58:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org> Thu Feb 20 03:58:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
@ -755,7 +764,7 @@ Mon Jan 13 20:45:19 2003 Guy Decoux <ts@moulon.inra.fr>
* parse.y (list_append): avoid O(n) search using node->nd_next->nd_end. * parse.y (list_append): avoid O(n) search using node->nd_next->nd_end.
* parse.y (list_append): ditto. * parse.y (list_concat): ditto.
* eval.c (rb_eval): NODE_ARRY nd_end adoption. * eval.c (rb_eval): NODE_ARRY nd_end adoption.
@ -853,13 +862,7 @@ Tue Jan 7 02:46:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* hash.c (env_clear): new Hash compatible method. * hash.c (env_clear): new Hash compatible method.
* hash.c (env_shift): ditto. * hash.c (env_shift, env_invert, env_replace, env_update): ditto.
* hash.c (env_invert): ditto.
* hash.c (env_replace): ditto.
* hash.c (env_update): ditto.
Mon Jan 6 23:36:29 2003 Akinori MUSHA <knu@iDaemons.org> Mon Jan 6 23:36:29 2003 Akinori MUSHA <knu@iDaemons.org>
@ -895,11 +898,7 @@ Mon Jan 6 16:44:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_join): dispatch based on "to_str". * array.c (rb_ary_join): dispatch based on "to_str".
* array.c (rb_ary_times): ditto. * array.c (rb_ary_times, rb_ary_equal): ditto.
* array.c (rb_ary_equal): ditto.
* process.c (rb_f_exec): dispatch based on "to_ary".
Mon Jan 6 13:26:35 2003 NAKAMURA Usaku <usa@ruby-lang.org> Mon Jan 6 13:26:35 2003 NAKAMURA Usaku <usa@ruby-lang.org>

24
eval.c
View file

@ -5164,9 +5164,9 @@ eval(self, src, scope, file, line)
ruby_cref = (NODE*)ruby_frame->cbase; ruby_cref = (NODE*)ruby_frame->cbase;
old_wrapper = ruby_wrapper; old_wrapper = ruby_wrapper;
ruby_wrapper = data->wrapper; ruby_wrapper = data->wrapper;
if ((file == 0 || (line == 1 && strcmp(file, "(eval)") == 0)) && if ((file == 0 || (line == 1 && strcmp(file, "(eval)") == 0)) && data->body) {
data->body && data->body->nd_file) {
file = data->body->nd_file; file = data->body->nd_file;
if (!file) file = "__builtin__";
line = nd_line(data->body); line = nd_line(data->body);
} }
@ -7223,7 +7223,8 @@ method_inspect(method)
} }
static VALUE static VALUE
mproc() mproc(method)
VALUE method;
{ {
VALUE proc; VALUE proc;
@ -7234,6 +7235,16 @@ mproc()
POP_FRAME(); POP_FRAME();
POP_ITER(); POP_ITER();
if (method) {
struct METHOD *mdata;
struct BLOCK *bdata;
Data_Get_Struct(method, struct METHOD, mdata);
Data_Get_Struct(proc, struct BLOCK, bdata);
bdata->body->nd_file = mdata->body->nd_file;
nd_set_line(bdata->body, nd_line(mdata->body));
}
return proc; return proc;
} }
@ -7264,14 +7275,14 @@ static VALUE
method_proc(method) method_proc(method)
VALUE method; VALUE method;
{ {
return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, bmcall, method); return rb_iterate((VALUE(*)_((VALUE)))mproc, method, bmcall, method);
} }
static VALUE static VALUE
umethod_proc(method) umethod_proc(method)
VALUE method; VALUE method;
{ {
return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, umcall, method); return rb_iterate((VALUE(*)_((VALUE)))mproc, method, umcall, method);
} }
static VALUE static VALUE
@ -7456,7 +7467,7 @@ enum thread_status {
THREAD_TO_KILL, THREAD_TO_KILL,
THREAD_RUNNABLE, THREAD_RUNNABLE,
THREAD_STOPPED, THREAD_STOPPED,
THREAD_KILLED THREAD_KILLED,
}; };
#define WAIT_FD (1<<0) #define WAIT_FD (1<<0)
@ -9010,6 +9021,7 @@ rb_thread_create(fn, arg)
VALUE (*fn)(); VALUE (*fn)();
void *arg; void *arg;
{ {
Init_stack((VALUE*)&arg);
return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread)); return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
} }

27
gc.c
View file

@ -562,7 +562,7 @@ rb_mark_tbl(tbl)
} }
static int static int
mark_hashentry(key, value) mark_keyvalue(key, value)
VALUE key; VALUE key;
VALUE value; VALUE value;
{ {
@ -576,7 +576,7 @@ rb_mark_hash(tbl)
st_table *tbl; st_table *tbl;
{ {
if (!tbl) return; if (!tbl) return;
st_foreach(tbl, mark_hashentry, 0); st_foreach(tbl, mark_keyvalue, 0);
} }
void void
@ -1246,6 +1246,18 @@ rb_gc_start()
return Qnil; return Qnil;
} }
#if !defined(__human68k__)
static int
stack_growup_p(addr)
VALUE *addr;
{
SET_STACK_END;
if (STACK_END > addr) return Qtrue;
return Qfalse;
}
#endif
void void
Init_stack(addr) Init_stack(addr)
VALUE *addr; VALUE *addr;
@ -1255,6 +1267,17 @@ Init_stack(addr)
rb_gc_stack_start = _SEND; rb_gc_stack_start = _SEND;
#else #else
if (!addr) addr = (VALUE *)&addr; if (!addr) addr = (VALUE *)&addr;
if (rb_gc_stack_start) {
if (stack_growup_p(addr)) {
if (rb_gc_stack_start > addr)
rb_gc_stack_start = addr;
}
else {
if (rb_gc_stack_start < addr)
rb_gc_stack_start = addr;
}
return;
}
rb_gc_stack_start = addr; rb_gc_stack_start = addr;
#endif #endif
#ifdef HAVE_GETRLIMIT #ifdef HAVE_GETRLIMIT

View file

@ -594,7 +594,7 @@ flo_gt(x, y)
break; break;
default: default:
return rb_num_coerce_bin(x, y); return rb_num_coerce_cmp(x, y);
} }
return (a > b)?Qtrue:Qfalse; return (a > b)?Qtrue:Qfalse;
} }
@ -620,7 +620,7 @@ flo_ge(x, y)
break; break;
default: default:
return rb_num_coerce_bin(x, y); return rb_num_coerce_cmp(x, y);
} }
return (a >= b)?Qtrue:Qfalse; return (a >= b)?Qtrue:Qfalse;
} }
@ -646,7 +646,7 @@ flo_lt(x, y)
break; break;
default: default:
return rb_num_coerce_bin(x, y); return rb_num_coerce_cmp(x, y);
} }
return (a < b)?Qtrue:Qfalse; return (a < b)?Qtrue:Qfalse;
} }
@ -672,7 +672,7 @@ flo_le(x, y)
break; break;
default: default:
return rb_num_coerce_bin(x, y); return rb_num_coerce_cmp(x, y);
} }
return (a <= b)?Qtrue:Qfalse; return (a <= b)?Qtrue:Qfalse;
} }
@ -1407,7 +1407,7 @@ fix_gt(x, y)
return Qfalse; return Qfalse;
} }
else { else {
return rb_num_coerce_bin(x, y); return rb_num_coerce_cmp(x, y);
} }
} }
@ -1422,7 +1422,7 @@ fix_ge(x, y)
return Qfalse; return Qfalse;
} }
else { else {
return rb_num_coerce_bin(x, y); return rb_num_coerce_cmp(x, y);
} }
} }
@ -1437,7 +1437,7 @@ fix_lt(x, y)
return Qfalse; return Qfalse;
} }
else { else {
return rb_num_coerce_bin(x, y); return rb_num_coerce_cmp(x, y);
} }
} }
@ -1452,7 +1452,7 @@ fix_le(x, y)
return Qfalse; return Qfalse;
} }
else { else {
return rb_num_coerce_bin(x, y); return rb_num_coerce_cmp(x, y);
} }
} }

View file

@ -70,9 +70,6 @@ str_new(klass, ptr, len)
if (ptr) { if (ptr) {
memcpy(RSTRING(str)->ptr, ptr, len); memcpy(RSTRING(str)->ptr, ptr, len);
} }
else {
MEMZERO(RSTRING(str)->ptr, char, len);
}
RSTRING(str)->ptr[len] = '\0'; RSTRING(str)->ptr[len] = '\0';
return str; return str;
} }