From 5f2d8e4ecaba40497b7bc97fda312f84774a3f6d Mon Sep 17 00:00:00 2001 From: yugui Date: Tue, 18 Nov 2008 16:46:47 +0000 Subject: merges r20224 from trunk into ruby_1_9_1 * include/ruby/intern.h (rb_{external,locale}_str_new_cstr): optimized versions for literal strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/intern.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/ruby') diff --git a/include/ruby/intern.h b/include/ruby/intern.h index a04ae309b8..a2d4fcb91a 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -621,6 +621,18 @@ size_t rb_str_capacity(VALUE); rb_usascii_str_new(str, strlen(str)) : \ rb_usascii_str_new_cstr(str); \ }) +#define rb_external_str_new_cstr(str) __extension__ ( \ +{ \ + (__builtin_constant_p(str)) ? \ + rb_external_str_new(str, strlen(str)) : \ + rb_external_str_new_cstr(str); \ +}) +#define rb_locale_str_new_cstr(str) __extension__ ( \ +{ \ + (__builtin_constant_p(str)) ? \ + rb_locale_str_new(str, strlen(str)) : \ + rb_locale_str_new_cstr(str); \ +}) #define rb_str_buf_new_cstr(str) __extension__ ( \ { \ (__builtin_constant_p(str)) ? \ -- cgit v1.2.3