summaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-09 09:25:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-09 09:25:32 +0000
commita37463ef14409c81422b3c3d6c35a0dbd21f51b7 (patch)
tree294dcb47e83e5480b1fa992aba8a4b4025c8a626 /error.c
parent32a51c5c95dde9e78161cccc9e75303a5523540b (diff)
downloadruby-a37463ef14409c81422b3c3d6c35a0dbd21f51b7.tar.gz
ruby-a37463ef14409c81422b3c3d6c35a0dbd21f51b7.tar.xz
ruby-a37463ef14409c81422b3c3d6c35a0dbd21f51b7.zip
* include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/error.c b/error.c
index f339fb385..2210a705a 100644
--- a/error.c
+++ b/error.c
@@ -496,9 +496,9 @@ exc_inspect(VALUE exc)
static VALUE
exc_backtrace(VALUE exc)
{
- static ID bt;
+ ID bt;
- if (!bt) bt = rb_intern("bt");
+ CONST_ID(bt, "bt");
return rb_attr_get(exc, bt);
}
@@ -506,7 +506,7 @@ VALUE
rb_check_backtrace(VALUE bt)
{
long i;
- static const char *err = "backtrace must be Array of String";
+ static const char err[] = "backtrace must be Array of String";
if (!NIL_P(bt)) {
int t = TYPE(bt);
@@ -552,11 +552,12 @@ exc_set_backtrace(VALUE exc, VALUE bt)
static VALUE
exc_equal(VALUE exc, VALUE obj)
{
- ID id_mesg = rb_intern("mesg");
+ ID id_mesg;
if (exc == obj) return Qtrue;
if (rb_obj_class(exc) != rb_obj_class(obj))
return rb_equal(obj, exc);
+ CONST_ID(id_mesg, "mesg");
if (!rb_equal(rb_attr_get(exc, id_mesg), rb_attr_get(obj, id_mesg)))
return Qfalse;
if (!rb_equal(exc_backtrace(exc), exc_backtrace(obj)))
@@ -963,7 +964,9 @@ static VALUE
syserr_eqq(VALUE self, VALUE exc)
{
VALUE num, e;
- ID en = rb_intern("errno");
+ ID en;
+
+ CONST_ID(en, "errno");
if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) {
if (!rb_respond_to(exc, en)) return Qfalse;