aboutsummaryrefslogtreecommitdiffstats
path: root/internal.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-04 06:35:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-04 06:35:34 +0000
commit94c70c7d724870baf4a6eb108200128b7319c4ea (patch)
treeba5a5d2242859dcb2a9831573ef07ee81d4b41d9 /internal.h
parent10ff672a30e9195baf1240abd301b74af040fbe2 (diff)
downloadruby-94c70c7d724870baf4a6eb108200128b7319c4ea.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.h14
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);