[前][次][番号順一覧][スレッド一覧]

ruby-changes:8689

From: nobu <ko1@a...>
Date: Wed, 12 Nov 2008 03:31:30 +0900 (JST)
Subject: [ruby-changes:8689] Ruby:r20224 (trunk): * include/ruby/intern.h (rb_{external,locale}_str_new_cstr): optimized

nobu	2008-11-12 03:31:06 +0900 (Wed, 12 Nov 2008)

  New Revision: 20224

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20224

  Log:
    * include/ruby/intern.h (rb_{external,locale}_str_new_cstr): optimized
      versions for literal strings.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/intern.h
    trunk/string.c

Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 20223)
+++ include/ruby/intern.h	(revision 20224)
@@ -621,6 +621,18 @@
 	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)) ?		\
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20223)
+++ ChangeLog	(revision 20224)
@@ -1,3 +1,8 @@
+Wed Nov 12 03:30:59 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* load.c (rb_require_safe): destroys barrier after successfully
Index: string.c
===================================================================
--- string.c	(revision 20223)
+++ string.c	(revision 20224)
@@ -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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]