* string.c (rb_str_upto): method result must be checked. [ruby-dev:24504]
* eval.c (error_print): ditto. [ruby-dev:24519] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f2549e0bf7
commit
39324f819f
@ -1,3 +1,9 @@
|
|||||||
|
Tue Oct 19 08:47:21 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (rb_str_upto): method result must be checked. [ruby-dev:24504]
|
||||||
|
|
||||||
|
* eval.c (error_print): ditto. [ruby-dev:24519]
|
||||||
|
|
||||||
Mon Oct 18 23:37:05 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Oct 18 23:37:05 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* marshal.c (r_object0): check inheritance by the internal function.
|
* marshal.c (r_object0): check inheritance by the internal function.
|
||||||
|
61
eval.c
61
eval.c
@ -733,9 +733,9 @@ struct RVarmap *ruby_dyna_vars;
|
|||||||
ruby_dyna_vars = 0
|
ruby_dyna_vars = 0
|
||||||
|
|
||||||
#define POP_VARS() \
|
#define POP_VARS() \
|
||||||
if (_old && (ruby_scope->flags & SCOPE_DONT_RECYCLE)) {\
|
if (_old && (ruby_scope->flags & SCOPE_DONT_RECYCLE)) {\
|
||||||
if (RBASIC(_old)->flags) /* unless it's already recycled */ \
|
if (RBASIC(_old)->flags) /* unless it's already recycled */ \
|
||||||
FL_SET(_old, DVAR_DONT_RECYCLE); \
|
FL_SET(_old, DVAR_DONT_RECYCLE); \
|
||||||
}\
|
}\
|
||||||
ruby_dyna_vars = _old; \
|
ruby_dyna_vars = _old; \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -983,15 +983,15 @@ static void scope_dup _((struct SCOPE *));
|
|||||||
|
|
||||||
#define POP_SCOPE() \
|
#define POP_SCOPE() \
|
||||||
if (ruby_scope->flags & SCOPE_DONT_RECYCLE) {\
|
if (ruby_scope->flags & SCOPE_DONT_RECYCLE) {\
|
||||||
if (_old) scope_dup(_old); \
|
if (_old) scope_dup(_old); \
|
||||||
} \
|
} \
|
||||||
if (!(ruby_scope->flags & SCOPE_MALLOC)) {\
|
if (!(ruby_scope->flags & SCOPE_MALLOC)) {\
|
||||||
ruby_scope->local_vars = 0; \
|
ruby_scope->local_vars = 0; \
|
||||||
ruby_scope->local_tbl = 0; \
|
ruby_scope->local_tbl = 0; \
|
||||||
if (!(ruby_scope->flags & SCOPE_DONT_RECYCLE) && \
|
if (!(ruby_scope->flags & SCOPE_DONT_RECYCLE) && \
|
||||||
ruby_scope != top_scope) { \
|
ruby_scope != top_scope) { \
|
||||||
rb_gc_force_recycle((VALUE)ruby_scope);\
|
rb_gc_force_recycle((VALUE)ruby_scope);\
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
ruby_scope->flags |= SCOPE_NOSTACK; \
|
ruby_scope->flags |= SCOPE_NOSTACK; \
|
||||||
ruby_scope = _old; \
|
ruby_scope = _old; \
|
||||||
@ -1031,7 +1031,7 @@ void
|
|||||||
ruby_set_current_source()
|
ruby_set_current_source()
|
||||||
{
|
{
|
||||||
if (ruby_current_node) {
|
if (ruby_current_node) {
|
||||||
ruby_sourcefile = ruby_current_node->nd_file;
|
ruby_sourcefile = ruby_current_node->nd_file;
|
||||||
ruby_sourceline = nd_line(ruby_current_node);
|
ruby_sourceline = nd_line(ruby_current_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1130,6 +1130,7 @@ error_print()
|
|||||||
eclass = CLASS_OF(ruby_errinfo);
|
eclass = CLASS_OF(ruby_errinfo);
|
||||||
if (EXEC_TAG() == 0) {
|
if (EXEC_TAG() == 0) {
|
||||||
e = rb_funcall(ruby_errinfo, rb_intern("message"), 0, 0);
|
e = rb_funcall(ruby_errinfo, rb_intern("message"), 0, 0);
|
||||||
|
StringValue(e);
|
||||||
einfo = RSTRING(e)->ptr;
|
einfo = RSTRING(e)->ptr;
|
||||||
elen = RSTRING(e)->len;
|
elen = RSTRING(e)->len;
|
||||||
}
|
}
|
||||||
@ -1712,7 +1713,7 @@ rb_eval_cmd(cmd, arg, level)
|
|||||||
val = eval(ruby_top_self, cmd, Qnil, 0, 0);
|
val = eval(ruby_top_self, cmd, Qnil, 0, 0);
|
||||||
}
|
}
|
||||||
if (ruby_scope->flags & SCOPE_DONT_RECYCLE)
|
if (ruby_scope->flags & SCOPE_DONT_RECYCLE)
|
||||||
scope_dup(saved_scope);
|
scope_dup(saved_scope);
|
||||||
ruby_scope = saved_scope;
|
ruby_scope = saved_scope;
|
||||||
ruby_safe_level = safe;
|
ruby_safe_level = safe;
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
@ -2093,25 +2094,25 @@ copy_node_scope(node, rval)
|
|||||||
}\
|
}\
|
||||||
else if (nd_type(n) == NODE_ARRAY) {\
|
else if (nd_type(n) == NODE_ARRAY) {\
|
||||||
argc=alen;\
|
argc=alen;\
|
||||||
if (argc > 0) {\
|
if (argc > 0) {\
|
||||||
int i;\
|
int i;\
|
||||||
n = anode;\
|
n = anode;\
|
||||||
argv = TMP_ALLOC(argc);\
|
argv = TMP_ALLOC(argc);\
|
||||||
for (i=0;i<argc;i++) {\
|
for (i=0;i<argc;i++) {\
|
||||||
argv[i] = rb_eval(self,n->nd_head);\
|
argv[i] = rb_eval(self,n->nd_head);\
|
||||||
n=n->nd_next;\
|
n=n->nd_next;\
|
||||||
}\
|
}\
|
||||||
}\
|
}\
|
||||||
else {\
|
else {\
|
||||||
argc = 0;\
|
argc = 0;\
|
||||||
argv = 0;\
|
argv = 0;\
|
||||||
}\
|
}\
|
||||||
}\
|
}\
|
||||||
else {\
|
else {\
|
||||||
VALUE args = rb_eval(self,n);\
|
VALUE args = rb_eval(self,n);\
|
||||||
if (TYPE(args) != T_ARRAY)\
|
if (TYPE(args) != T_ARRAY)\
|
||||||
args = rb_ary_to_ary(args);\
|
args = rb_ary_to_ary(args);\
|
||||||
argc = RARRAY(args)->len;\
|
argc = RARRAY(args)->len;\
|
||||||
argv = ALLOCA_N(VALUE, argc);\
|
argv = ALLOCA_N(VALUE, argc);\
|
||||||
MEMCPY(argv, RARRAY(args)->ptr, VALUE, argc);\
|
MEMCPY(argv, RARRAY(args)->ptr, VALUE, argc);\
|
||||||
}\
|
}\
|
||||||
@ -2124,7 +2125,7 @@ copy_node_scope(node, rval)
|
|||||||
int tmp_iter = ruby_iter->iter;\
|
int tmp_iter = ruby_iter->iter;\
|
||||||
if (tmp_iter == ITER_PRE) {\
|
if (tmp_iter == ITER_PRE) {\
|
||||||
ruby_block = ruby_block->outer;\
|
ruby_block = ruby_block->outer;\
|
||||||
tmp_iter = ITER_NOT;\
|
tmp_iter = ITER_NOT;\
|
||||||
}\
|
}\
|
||||||
PUSH_ITER(tmp_iter)
|
PUSH_ITER(tmp_iter)
|
||||||
|
|
||||||
@ -2150,13 +2151,13 @@ arg_defined(self, node, buf, type)
|
|||||||
if (!node) return type; /* no args */
|
if (!node) return type; /* no args */
|
||||||
if (nd_type(node) == NODE_ARRAY) {
|
if (nd_type(node) == NODE_ARRAY) {
|
||||||
argc=node->nd_alen;
|
argc=node->nd_alen;
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
for (i=0;i<argc;i++) {
|
for (i=0;i<argc;i++) {
|
||||||
if (!is_defined(self, node->nd_head, buf, 0))
|
if (!is_defined(self, node->nd_head, buf, 0))
|
||||||
return 0;
|
return 0;
|
||||||
node = node->nd_next;
|
node = node->nd_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!is_defined(self, node, buf, 0)) {
|
else if (!is_defined(self, node, buf, 0)) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -2687,7 +2688,7 @@ rb_eval(self, n)
|
|||||||
|
|
||||||
/* nodes for speed-up(literal match) */
|
/* nodes for speed-up(literal match) */
|
||||||
case NODE_MATCH3:
|
case NODE_MATCH3:
|
||||||
{
|
{
|
||||||
VALUE r = rb_eval(self,node->nd_recv);
|
VALUE r = rb_eval(self,node->nd_recv);
|
||||||
VALUE l = rb_eval(self,node->nd_value);
|
VALUE l = rb_eval(self,node->nd_value);
|
||||||
if (TYPE(l) == T_STRING) {
|
if (TYPE(l) == T_STRING) {
|
||||||
@ -3000,7 +3001,7 @@ rb_eval(self, n)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NODE_RESCUE:
|
case NODE_RESCUE:
|
||||||
{
|
{
|
||||||
volatile VALUE e_info = ruby_errinfo;
|
volatile VALUE e_info = ruby_errinfo;
|
||||||
volatile int rescuing = 0;
|
volatile int rescuing = 0;
|
||||||
|
|
||||||
@ -3051,7 +3052,7 @@ rb_eval(self, n)
|
|||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NODE_ENSURE:
|
case NODE_ENSURE:
|
||||||
PUSH_TAG(PROT_NONE);
|
PUSH_TAG(PROT_NONE);
|
||||||
@ -3609,8 +3610,8 @@ rb_eval(self, n)
|
|||||||
nd_set_type(node, NODE_LIT);
|
nd_set_type(node, NODE_LIT);
|
||||||
node->nd_lit = result;
|
node->nd_lit = result;
|
||||||
break;
|
break;
|
||||||
case NODE_LIT:
|
case NODE_LIT:
|
||||||
/* other thread may replace NODE_DREGX_ONCE to NODE_LIT */
|
/* other thread may replace NODE_DREGX_ONCE to NODE_LIT */
|
||||||
goto again;
|
goto again;
|
||||||
case NODE_DXSTR:
|
case NODE_DXSTR:
|
||||||
result = rb_funcall(self, '`', 1, str);
|
result = rb_funcall(self, '`', 1, str);
|
||||||
@ -3747,8 +3748,8 @@ rb_eval(self, n)
|
|||||||
rb_raise(rb_eTypeError, "no outer class/module");
|
rb_raise(rb_eTypeError, "no outer class/module");
|
||||||
}
|
}
|
||||||
if (node->nd_super) {
|
if (node->nd_super) {
|
||||||
super = rb_eval(self, node->nd_super);
|
super = rb_eval(self, node->nd_super);
|
||||||
rb_check_inheritable(super);
|
rb_check_inheritable(super);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
super = 0;
|
super = 0;
|
||||||
@ -4754,7 +4755,7 @@ rb_yield_0(val, self, klass, flags, avalue)
|
|||||||
ruby_cref = (NODE*)old_cref;
|
ruby_cref = (NODE*)old_cref;
|
||||||
ruby_wrapper = old_wrapper;
|
ruby_wrapper = old_wrapper;
|
||||||
if (ruby_scope->flags & SCOPE_DONT_RECYCLE)
|
if (ruby_scope->flags & SCOPE_DONT_RECYCLE)
|
||||||
scope_dup(old_scope);
|
scope_dup(old_scope);
|
||||||
ruby_scope = old_scope;
|
ruby_scope = old_scope;
|
||||||
scope_vmode = old_vmode;
|
scope_vmode = old_vmode;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
@ -8934,7 +8935,7 @@ method_arity(method)
|
|||||||
case NODE_IVAR:
|
case NODE_IVAR:
|
||||||
return INT2FIX(0);
|
return INT2FIX(0);
|
||||||
case NODE_BMETHOD:
|
case NODE_BMETHOD:
|
||||||
return proc_arity(body->nd_cval);
|
return proc_arity(body->nd_cval);
|
||||||
default:
|
default:
|
||||||
body = body->nd_next; /* skip NODE_SCOPE */
|
body = body->nd_next; /* skip NODE_SCOPE */
|
||||||
if (nd_type(body) == NODE_BLOCK)
|
if (nd_type(body) == NODE_BLOCK)
|
||||||
@ -10270,9 +10271,9 @@ rb_thread_schedule()
|
|||||||
th->wait_for = 0;
|
th->wait_for = 0;
|
||||||
th->select_value = 0;
|
th->select_value = 0;
|
||||||
found = 1;
|
found = 1;
|
||||||
intersect_fds(&readfds, &th->readfds, max);
|
intersect_fds(&readfds, &th->readfds, max);
|
||||||
intersect_fds(&writefds, &th->writefds, max);
|
intersect_fds(&writefds, &th->writefds, max);
|
||||||
intersect_fds(&exceptfds, &th->exceptfds, max);
|
intersect_fds(&exceptfds, &th->exceptfds, max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END_FOREACH_FROM(curr, th);
|
END_FOREACH_FROM(curr, th);
|
||||||
|
3
string.c
3
string.c
@ -1418,6 +1418,7 @@ rb_str_upto(beg, end, excl)
|
|||||||
rb_yield(current);
|
rb_yield(current);
|
||||||
if (!excl && rb_str_equal(current, end)) break;
|
if (!excl && rb_str_equal(current, end)) break;
|
||||||
current = rb_funcall(current, succ, 0, 0);
|
current = rb_funcall(current, succ, 0, 0);
|
||||||
|
StringValue(current);
|
||||||
if (excl && rb_str_equal(current, end)) break;
|
if (excl && rb_str_equal(current, end)) break;
|
||||||
if (RSTRING(current)->len > RSTRING(end)->len)
|
if (RSTRING(current)->len > RSTRING(end)->len)
|
||||||
break;
|
break;
|
||||||
@ -2064,7 +2065,7 @@ str_gsub(argc, argv, str, bang)
|
|||||||
bp += len;
|
bp += len;
|
||||||
memcpy(bp, RSTRING(val)->ptr, RSTRING(val)->len);
|
memcpy(bp, RSTRING(val)->ptr, RSTRING(val)->len);
|
||||||
bp += RSTRING(val)->len;
|
bp += RSTRING(val)->len;
|
||||||
offset = END(0);
|
offset = END(0);
|
||||||
if (BEG(0) == END(0)) {
|
if (BEG(0) == END(0)) {
|
||||||
/*
|
/*
|
||||||
* Always consume at least one character of the input string
|
* Always consume at least one character of the input string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user