diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-02-04 06:35:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-02-04 06:35:34 +0000 |
commit | af05335cd830306283bb40df86b7a8dc0af2aba3 (patch) | |
tree | ba5a5d2242859dcb2a9831573ef07ee81d4b41d9 /internal.h | |
parent | 778d3fe4d476e7e164f73c8570c4b236ed719ab1 (diff) | |
download | ruby-af05335cd830306283bb40df86b7a8dc0af2aba3.tar.gz |
fstring_enc_new
* string.c (rb_fstring_enc_new, rb_fstring_enc_cstr): functions to
make fstring with encoding.
* re.c (rb_reg_initialize): make fstring without copying.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal.h b/internal.h index 0ebda869c6..637ef1619b 100644 --- a/internal.h +++ b/internal.h @@ -1135,6 +1135,20 @@ VALUE rb_fstring_cstr(const char *str); rb_fstring_cstr(str); \ }) #endif +#ifdef RUBY_ENCODING_H +VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc); +#define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc)) +#define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc) +VALUE rb_fstring_enc_cstr(const char *ptr, rb_encoding *enc); +#if defined(__GNUC__) && !defined(__PCC__) +#define rb_fstring_enc_cstr(str, enc) __extension__ ( \ +{ \ + (__builtin_constant_p(str)) ? \ + rb_fstring_enc_new((str), (long)strlen(str), (enc)) : \ + rb_fstring_enc_cstr(str, enc); \ +}) +#endif +#endif int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p); int rb_str_symname_p(VALUE); VALUE rb_str_quote_unprintable(VALUE); |