From 5a647a3f5fd011f8558c7f9e90cd65e70e73eb40 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 9 Jun 2008 09:25:32 +0000 Subject: * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc. * *.c: no cache in init functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'error.c') diff --git a/error.c b/error.c index f339fb3858..2210a705af 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; -- cgit v1.2.3