diff options
Diffstat (limited to 'include/ruby/intern.h')
-rw-r--r-- | include/ruby/intern.h | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/include/ruby/intern.h b/include/ruby/intern.h index b009384d9f..29fa2c2a2c 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -537,26 +537,6 @@ VALUE rb_str_buf_new2(const char*); VALUE rb_str_tmp_new(long); VALUE rb_usascii_str_new(const char*, long); VALUE rb_usascii_str_new2(const char*); -#if defined __GNUC__ -#define rb_str_new2(str) __extension__ ( \ -{ \ - (__builtin_constant_p(str)) ? \ - rb_str_new(str, strlen(str)) : \ - rb_str_new2(str); \ -}) -#define rb_tainted_str_new2(str) __extension__ ( \ -{ \ - (__builtin_constant_p(str)) ? \ - rb_tainted_str_new(str, strlen(str)) : \ - rb_tainted_str_new2(str); \ -}) -#define rb_usascii_str_new2(str) __extension__ ( \ -{ \ - (__builtin_constant_p(str)) ? \ - rb_usascii_str_new(str, strlen(str)) : \ - rb_usascii_str_new2(str); \ -}) -#endif void rb_str_free(VALUE); void rb_str_shared_replace(VALUE, VALUE); VALUE rb_str_buf_append(VALUE, VALUE); @@ -598,6 +578,38 @@ void rb_str_setter(VALUE, ID, VALUE*); VALUE rb_str_intern(VALUE); VALUE rb_sym_to_s(VALUE); VALUE rb_str_length(VALUE); +#if defined __GNUC__ +#define rb_str_new2(str) __extension__ ( \ +{ \ + (__builtin_constant_p(str)) ? \ + rb_str_new(str, strlen(str)) : \ + rb_str_new2(str); \ +}) +#define rb_tainted_str_new2(str) __extension__ ( \ +{ \ + (__builtin_constant_p(str)) ? \ + rb_tainted_str_new(str, strlen(str)) : \ + rb_tainted_str_new2(str); \ +}) +#define rb_usascii_str_new2(str) __extension__ ( \ +{ \ + (__builtin_constant_p(str)) ? \ + rb_usascii_str_new(str, strlen(str)) : \ + rb_usascii_str_new2(str); \ +}) +#define rb_str_buf_cat2(str, ptr) __extension__ ( \ +{ \ + (__builtin_constant_p(ptr)) ? \ + rb_str_buf_cat(str, ptr, strlen(ptr)) : \ + rb_str_buf_cat2(str, ptr); \ +}) +#define rb_str_cat2(str, ptr) __extension__ ( \ +{ \ + (__builtin_constant_p(ptr)) ? \ + rb_str_cat(str, ptr, strlen(ptr)) : \ + rb_str_cat2(str, ptr); \ +}) +#endif /* struct.c */ VALUE rb_struct_new(VALUE, ...); VALUE rb_struct_define(const char*, ...); |