summaryrefslogtreecommitdiffstats
path: root/include/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-01 01:41:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-01 01:41:43 +0000
commit9ea580eec7cde7dde9a8122667c73d8503c8e25a (patch)
tree0a040f9c6b2f1034b16057469afa552eb80e5df3 /include/ruby
parent4ea2d787e271c378102510efcf40578eb1f55779 (diff)
downloadruby-9ea580eec7cde7dde9a8122667c73d8503c8e25a.tar.gz
ruby-9ea580eec7cde7dde9a8122667c73d8503c8e25a.tar.xz
ruby-9ea580eec7cde7dde9a8122667c73d8503c8e25a.zip
* include/ruby/intern.h (rb_exc_new2): optimization for literal.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
-rw-r--r--include/ruby/intern.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index ec6527fc3..08229f589 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -693,6 +693,12 @@ size_t rb_str_capacity(VALUE);
rb_str_cat(str, ptr, strlen(ptr)) : \
rb_str_cat2(str, ptr); \
})
+#define rb_exc_new2(klass, ptr) __extension__ ( \
+{ \
+ (__builtin_constant_p(ptr)) ? \
+ rb_exc_new(klass, ptr, strlen(ptr)) : \
+ rb_exc_new2(klass, ptr); \
+})
#endif
#define rb_str_new2 rb_str_new_cstr
#define rb_str_new3 rb_str_new_shared