summaryrefslogtreecommitdiff
path: root/include/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-21 19:26:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-21 19:26:18 +0000
commit5ffd0cc80fda095b69660fb4ae72ffd227e9f7b7 (patch)
treec9edbcee6c2018a6762987219c48168e1eb6b936 /include/ruby
parentcd9e9c6debcf893ea5fa70e42dc1875afaf0066f (diff)
* include/ruby/intern.h (rb_str_buf_new2): optimization for literals.
* string.c (str_buf_cat): returns VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
-rw-r--r--include/ruby/intern.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 29fa2c2a2c..3d63c3877b 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -597,6 +597,13 @@ VALUE rb_str_length(VALUE);
rb_usascii_str_new(str, strlen(str)) : \
rb_usascii_str_new2(str); \
})
+#define rb_str_buf_new2(str) __extension__ ( \
+{ \
+ (__builtin_constant_p(str)) ? \
+ rb_str_buf_cat(rb_str_buf_new(strlen(str)), \
+ str, strlen(str)) : \
+ rb_str_buf_new2(str); \
+})
#define rb_str_buf_cat2(str, ptr) __extension__ ( \
{ \
(__builtin_constant_p(ptr)) ? \