mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (is_defined): should check receiver only once.
* eval.c (is_defined): should handle NODE_NEWLINE. * file.c (rb_file_s_expand_path): memory leak fixed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
faac53f7ba
commit
760878b424
4 changed files with 18 additions and 6 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Wed Mar 20 16:05:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (is_defined): should check receiver only once.
|
||||
|
||||
* eval.c (is_defined): should handle NODE_NEWLINE.
|
||||
|
||||
Wed Mar 20 11:29:25 2002 Aristarkh A Zagorodnikov <xm@xml-objects.com>
|
||||
|
||||
* file.c (rb_file_s_expand_path): memory leak fixed.
|
||||
|
||||
Wed Mar 20 00:36:43 2002 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* util.c (ruby_getcwd): the content of buf is uncertain and must
|
||||
|
|
6
eval.c
6
eval.c
|
@ -1803,6 +1803,7 @@ is_defined(self, node, buf)
|
|||
VALUE val; /* OK */
|
||||
int state;
|
||||
|
||||
again:
|
||||
if (!node) return "expression";
|
||||
switch (nd_type(node)) {
|
||||
case NODE_SUPER:
|
||||
|
@ -1824,7 +1825,6 @@ is_defined(self, node, buf)
|
|||
goto check_bound;
|
||||
|
||||
case NODE_CALL:
|
||||
if (!is_defined(self, node->nd_recv, buf)) return 0;
|
||||
PUSH_TAG(PROT_NONE);
|
||||
if ((state = EXEC_TAG()) == 0) {
|
||||
val = rb_eval(self, node->nd_recv);
|
||||
|
@ -1960,6 +1960,10 @@ is_defined(self, node, buf)
|
|||
}
|
||||
break;
|
||||
|
||||
case NODE_NEWLINE:
|
||||
node = node->nd_next;
|
||||
goto again;
|
||||
|
||||
default:
|
||||
PUSH_TAG(PROT_NONE);
|
||||
if ((state = EXEC_TAG()) == 0) {
|
||||
|
|
1
file.c
1
file.c
|
@ -1469,6 +1469,7 @@ rb_file_s_expand_path(argc, argv)
|
|||
tainted = 1;
|
||||
BUFCHECK (strlen(dir) > buflen);
|
||||
strcpy(buf, dir);
|
||||
free(dir);
|
||||
p = &buf[strlen(buf)];
|
||||
}
|
||||
while (p > buf && *(p - 1) == '/') p--;
|
||||
|
|
7
parse.y
7
parse.y
|
@ -5021,12 +5021,10 @@ local_id(id)
|
|||
return Qfalse;
|
||||
}
|
||||
|
||||
static VALUE last_dyna_vars = 0;
|
||||
|
||||
static void
|
||||
top_local_init()
|
||||
{
|
||||
local_push(1);
|
||||
local_push();
|
||||
lvtbl->cnt = ruby_scope->local_tbl?ruby_scope->local_tbl[0]:0;
|
||||
if (lvtbl->cnt > 0) {
|
||||
lvtbl->tbl = ALLOC_N(ID, lvtbl->cnt+3);
|
||||
|
@ -5187,8 +5185,7 @@ Init_sym()
|
|||
{
|
||||
sym_tbl = st_init_strtable_with_size(200);
|
||||
sym_rev_tbl = st_init_numtable_with_size(200);
|
||||
rb_global_variable(&lex_lastline);
|
||||
rb_global_variable(&last_dyna_vars);
|
||||
rb_global_variable((VALUE*)&lex_lastline);
|
||||
}
|
||||
|
||||
static ID last_id = LAST_TOKEN;
|
||||
|
|
Loading…
Reference in a new issue