summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-03-16 09:26:38 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-03-16 09:26:38 +0000
commitbe458259da8b3e2623e426fd3354690e01da7a90 (patch)
tree10d8ceb3eed3fc1946701e631ccf16102d777c1c
parent7389bac70795aebdf532c13126f411d140c86045 (diff)
* eval.c (rb_call0): reorganize "return" event post.
* object.c (str_to_id): warn for NUL containing strings. * re.c (make_regexp): need to free internal regexp structure when compilation fails. [ruby-talk:133228] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog13
-rw-r--r--eval.c27
-rw-r--r--object.c3
-rw-r--r--re.c10
4 files changed, 34 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 3abcfd8eb0..498bd8c9b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Mar 16 18:08:32 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call0): reorganize "return" event post.
+
Tue Mar 15 23:49:19 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/iconv/iconv.c (Init_iconv): InvalidEncoding also should include
@@ -19,6 +23,10 @@ Mon Mar 14 12:21:03 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/timer.rb (TkRTTimer): forgot to reset the callback
time. So, 'continue' do all callbacks between 'stop' and 'continue'.
+Mon Mar 14 08:14:56 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (str_to_id): warn for NUL containing strings.
+
Mon Mar 14 00:13:49 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/timer.rb (TkRTTimer): correct calculation of offset
@@ -60,6 +68,11 @@ Thu Mar 10 19:12:06 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/sample/tktextio.rb: add test part of "seek by text index
modifiers"
+Thu Mar 10 08:10:11 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (make_regexp): need to free internal regexp structure when
+ compilation fails. [ruby-talk:133228]
+
Wed Mar 9 20:25:58 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_ssl.c (ossl_start_ssl, ossl_ssl_write): call
diff --git a/eval.c b/eval.c
index 761ef08d09..550f658ede 100644
--- a/eval.c
+++ b/eval.c
@@ -5470,6 +5470,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
volatile VALUE result = Qnil;
int itr;
static int tick;
+ volatile int trace_status = 0; /* 0:none 1:cfunc 2:rfunc */
TMP_PROTECT;
switch (ruby_iter->iter) {
@@ -5507,21 +5508,10 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
len, rb_class2name(klass), rb_id2name(id));
}
if (trace_func) {
- int state;
-
call_trace_func("c-call", ruby_current_node, recv, id, klass);
- PUSH_TAG(PROT_FUNC);
- if ((state = EXEC_TAG()) == 0) {
- result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
- }
- POP_TAG();
- ruby_current_node = ruby_frame->node;
- call_trace_func("c-return", ruby_current_node, recv, id, klass);
- if (state) JUMP_TAG(state);
- }
- else {
- result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
+ trace_status = 1; /* cfunc */
}
+ result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
}
break;
@@ -5647,6 +5637,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
if (trace_func) {
call_trace_func("call", b2, recv, id, klass);
+ trace_status = 2; /* rfunc */
}
result = rb_eval(recv, body);
}
@@ -5659,8 +5650,14 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
POP_CLASS();
POP_SCOPE();
ruby_cref = saved_cref;
- if (trace_func) {
- call_trace_func("return", ruby_frame->prev->node, recv, id, klass);
+ switch (trace_status) {
+ case 0: break; /* none */
+ case 1: /* cfunc */
+ call_trace_func("c-return", body, recv, id, klass);
+ break;
+ case 2: /* rfunc */
+ call_trace_func("return", body, recv, id, klass);
+ break;
}
switch (state) {
case 0:
diff --git a/object.c b/object.c
index 20c6e342fa..12985ee481 100644
--- a/object.c
+++ b/object.c
@@ -1643,6 +1643,9 @@ str_to_id(str)
if (!RSTRING(str)->ptr || RSTRING(str)->len == 0) {
rb_raise(rb_eArgError, "empty symbol string");
}
+ if (RSTRING(str)->len != strlen(RSTRING(str)->ptr)) {
+ warn("Symbols should not contain NUL (\\0)");
+ }
return rb_intern(RSTRING(str)->ptr);
}
diff --git a/re.c b/re.c
index a8a82d413b..46aa8e5b96 100644
--- a/re.c
+++ b/re.c
@@ -641,6 +641,7 @@ make_regexp(s, len, flags)
err = re_compile_pattern(s, len, rp);
if (err != NULL) {
+ re_free_pattern(rp);
rb_reg_raise(s, len, err, 0);
}
return rp;
@@ -1627,7 +1628,7 @@ rb_reg_match_m(re, str)
* options are propagated, and new options may not be specified (a change as of
* Ruby 1.8). If <i>options</i> is a <code>Fixnum</code>, it should be one or
* more of the constants <code>Regexp::EXTENDED</code>,
- * <code>Regexp::IGNORECASE</code>, and <code>Regexp::POSIXLINE</code>,
+ * <code>Regexp::IGNORECASE</code>, and <code>Regexp::MULTILINE</code>,
* <em>or</em>-ed together. Otherwise, if <i>options</i> is not
* <code>nil</code>, the regexp will be case insensitive. The <i>lang</i>
* parameter enables multibyte support for the regexp: `n', `N' = none, `e',
@@ -1801,11 +1802,12 @@ rb_reg_quote(str)
/*
* call-seq:
- * Regexp.escape(str) => new_str
- * Regexp.quote(str) => new_str
+ * Regexp.escape(str) => a_str
+ * Regexp.quote(str) => a_str
*
* Escapes any characters that would have special meaning in a regular
- * expression. For any string,
+ * expression. Returns a new escaped string, or self if no characters are
+ * escaped. For any string,
* <code>Regexp.escape(<i>str</i>)=~<i>str</i></code> will be true.
*
* Regexp.escape('\\*?{}.') #=> \\\\\*\?\{\}\.