summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-14 07:25:56 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-14 07:25:56 +0000
commitb6f0af788882c25feacb68184ec0f7c04f52f2c5 (patch)
treeab726f463981a1effe9690b4b6236cb083b2791f /parse.y
parent127ac9f03ed2f3780c78b980dbae621ec43eef44 (diff)
* string.c (rb_str_intern): raise SecurityError only when $SAFE
level is greater than zero. [ruby-core:08862] * parse.y (rb_interned_p): new function to check if a string is already interned. * object.c (str_to_id): use rb_str_intern(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y11
1 files changed, 11 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index e2982f2..4359705 100644
--- a/parse.y
+++ b/parse.y
@@ -5991,6 +5991,17 @@ rb_symname_p(name)
return *m ? Qfalse : Qtrue;
}
+int
+rb_sym_interned_p(str)
+ VALUE str;
+{
+ ID id;
+
+ if (st_lookup(sym_tbl, (st_data_t)RSTRING(str)->ptr, (st_data_t *)&id))
+ return Qtrue;
+ return Qfalse;
+}
+
ID
rb_intern(name)
const char *name;