summaryrefslogtreecommitdiffstats
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
commit9ae6f03b3496c5b05d7b3607f777bb3b113eeee7 (patch)
treec9edbcee6c2018a6762987219c48168e1eb6b936 /include/ruby
parentb3b908e87db7774362e53b73b615c6430437c6c9 (diff)
downloadruby-9ae6f03b3496c5b05d7b3607f777bb3b113eeee7.tar.gz
ruby-9ae6f03b3496c5b05d7b3607f777bb3b113eeee7.tar.xz
ruby-9ae6f03b3496c5b05d7b3607f777bb3b113eeee7.zip
* include/ruby/intern.h (rb_str_buf_new2): optimization for literals.
* string.c (str_buf_cat): returns VALUE. git-svn-id: http://svn.ruby-lang.org/repos/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 29fa2c2a2..3d63c3877 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)) ? \