summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-18 17:42:54 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-18 17:42:54 +0000
commite55e640a6f1a710bf1e344d462cc94316d5ecb39 (patch)
tree6b4f506ce863670bcf17d63a1649379f1d5c3bf2
parent6f77e4b4ba78f0d74d297219cae251161b466a48 (diff)
* ext/strscan/strscan.c: don't use rb_eval_string, it defines classes under the module when required in module clauses. [ruby-dev:22951]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--ext/strscan/strscan.c8
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index aa58782..a44c523 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
+Thu Feb 19 02:42:19 2004 Minero Aoki <aamine@loveruby.net>
+
+ * ext/strscan/strscan.c: don't use rb_eval_string, it defines
+ classes under the module when required in module clauses.
+ [ruby-dev:22951]
+
Thu Feb 19 02:37:28 2004 Minero Aoki <aamine@loveruby.net>
- * ext/strscan/strscan.c: merge documentation from 1.8 branch. Thanks Gavin Sinclair.
+ * ext/strscan/strscan.c: merge documentation from 1.8 branch.
+ Thanks Gavin Sinclair.
Wed Feb 19 00:20:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index 39d3d8b..8997cbf 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -1245,10 +1245,14 @@ inspect2(p)
void
Init_strscan()
{
- volatile VALUE tmp;
+ ID id_scanerr = rb_intern("ScanError");
+ VALUE tmp;
StringScanner = rb_define_class("StringScanner", rb_cObject);
- ScanError = rb_eval_string("class StringScanner; class Error < StandardError; end; end; ScanError = StringScanner::Error unless defined?(ScanError); StringScanner::Error");
+ ScanError = rb_define_class_under(StringScanner, "Error", rb_eStandardError);
+ if (!rb_const_defined(rb_cObject, id_scanerr)) {
+ rb_const_set(rb_cObject, id_scanerr, ScanError);
+ }
tmp = rb_str_new2(STRSCAN_VERSION);
rb_obj_freeze(tmp);
rb_const_set(StringScanner, rb_intern("Version"), tmp);