summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-18 16:46:47 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-18 16:46:47 +0000
commit8f13b05ec44b7813e2f43589c328fa675215eb67 (patch)
treea58fae9fd67b354a6cbef074ba0d5ee1c2bbbcab
parent194ad5c649bb0c1653fceff8b6b7c4b78df74563 (diff)
downloadruby-8f13b05ec44b7813e2f43589c328fa675215eb67.tar.gz
ruby-8f13b05ec44b7813e2f43589c328fa675215eb67.tar.xz
ruby-8f13b05ec44b7813e2f43589c328fa675215eb67.zip
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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--include/ruby/intern.h12
-rw-r--r--string.c2
3 files changed, 19 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 49cf7538e..a29412a34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Nov 12 03:30:59 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/intern.h (rb_{external,locale}_str_new_cstr): optimized
+ versions for literal strings.
+
Wed Nov 12 03:28:41 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* load.c (rb_require_safe): destroys barrier after successfully
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index a04ae309b..a2d4fcb91 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)) ? \
diff --git a/string.c b/string.c
index 3dd86c911..d931cd9ca 100644
--- a/string.c
+++ b/string.c
@@ -28,6 +28,8 @@
#undef rb_str_new_cstr
#undef rb_tainted_str_new_cstr
#undef rb_usascii_str_new_cstr
+#undef rb_external_str_new_cstr
+#undef rb_locale_str_new_cstr
#undef rb_str_new2
#undef rb_str_new3
#undef rb_str_new4