summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-20 09:43:15 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-20 09:43:15 +0000
commit760878b4242ae20a7b10f7a8f49d3875e0201aad (patch)
tree8510da313d4481225d854afdd0e949148e3815f6
parentfaac53f7baec4a2919bb941c0b7c0fcb62985381 (diff)
* 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
-rw-r--r--ChangeLog10
-rw-r--r--eval.c6
-rw-r--r--file.c1
-rw-r--r--parse.y7
4 files changed, 18 insertions, 6 deletions
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 <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
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;