diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-11 18:31:06 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-11 18:31:06 +0000 |
| commit | 1046dde2b26fe372f95a2295d4583aaccb6c804e (patch) | |
| tree | 39a9dfd7d038f6a66ab7e8633afa332b9892498b /include/ruby | |
| parent | 32f3ba6d8fd31aed3ce3d203450cf4041cc01c45 (diff) | |
| download | ruby-1046dde2b26fe372f95a2295d4583aaccb6c804e.tar.gz ruby-1046dde2b26fe372f95a2295d4583aaccb6c804e.tar.xz ruby-1046dde2b26fe372f95a2295d4583aaccb6c804e.zip | |
* 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/trunk@20224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
| -rw-r--r-- | include/ruby/intern.h | 12 |
1 files changed, 12 insertions, 0 deletions
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)) ? \ |
