From 9ae6f03b3496c5b05d7b3607f777bb3b113eeee7 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 21 Jul 2008 19:26:18 +0000 Subject: * 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 --- include/ruby/intern.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/ruby') 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)) ? \ -- cgit