diff --git a/ChangeLog b/ChangeLog index bfeda548fc..77aeaf4aee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Wed Mar 20 16:05:37 2002 Yukihiro Matsumoto + + * 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 + + * file.c (rb_file_s_expand_path): memory leak fixed. + Wed Mar 20 00:36:43 2002 Akinori MUSHA * util.c (ruby_getcwd): the content of buf is uncertain and must diff --git a/eval.c b/eval.c index 5e2131ebed..32f7972c39 100644 --- a/eval.c +++ b/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) { diff --git a/file.c b/file.c index 5a79c13fbd..1735012584 100644 --- a/file.c +++ b/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--; diff --git a/parse.y b/parse.y index 01eef2ed0c..db8115eee5 100644 --- a/parse.y +++ b/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;