diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | gc.c | 2 | ||||
-rw-r--r-- | internal.h | 2 |
3 files changed, 7 insertions, 2 deletions
@@ -1,4 +1,7 @@ -Wed Jun 24 12:47:05 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> +Wed Jun 24 12:47:14 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * internal.h (rb_fstring_lit): new macro to make a fstring from a + string literal. * include/ruby/intern.h (rb_strlen_lit): new macro to get the length of a string literal, borrowed from mruby/mruby@e4afd53. @@ -9192,7 +9192,7 @@ Init_GC(void) { VALUE opts; rb_define_const(rb_mGC, "OPTS", opts = rb_ary_new()); -#define OPT(o) if (o) rb_ary_push(opts, rb_fstring_new(#o, strlen(#o))) +#define OPT(o) if (o) rb_ary_push(opts, rb_fstring_lit(#o)) OPT(GC_DEBUG); OPT(USE_RGENGC); OPT(RGENGC_DEBUG); diff --git a/internal.h b/internal.h index 84eb6e204e..7b085cee31 100644 --- a/internal.h +++ b/internal.h @@ -1089,6 +1089,8 @@ size_t rb_strftime(char *s, size_t maxsize, const char *format, rb_encoding *enc void Init_frozen_strings(void); VALUE rb_fstring(VALUE); VALUE rb_fstring_new(const char *ptr, long len); +#define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str)) +#define rb_fstring_literal(str) rb_fstring_lit(str) 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); |