ruby-changes:38927
From: nobu <ko1@a...>
Date: Wed, 24 Jun 2015 12:50:41 +0900 (JST)
Subject: [ruby-changes:38927] nobu:r51008 (trunk): internal.h: rb_fstring_lit
nobu 2015-06-24 12:47:37 +0900 (Wed, 24 Jun 2015) New Revision: 51008 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51008 Log: internal.h: rb_fstring_lit * internal.h (rb_fstring_lit): new macro to make a fstring from a string literal. Modified files: trunk/ChangeLog trunk/gc.c trunk/internal.h Index: ChangeLog =================================================================== --- ChangeLog (revision 51007) +++ ChangeLog (revision 51008) @@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Wed Jun 24 12:47:05 2015 Nobuyoshi Nakada <nobu@r...> +Wed Jun 24 12:47:14 2015 Nobuyoshi Nakada <nobu@r...> + + * 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. Index: gc.c =================================================================== --- gc.c (revision 51007) +++ gc.c (revision 51008) @@ -9192,7 +9192,7 @@ Init_GC(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L9192 { 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); Index: internal.h =================================================================== --- internal.h (revision 51007) +++ internal.h (revision 51008) @@ -1089,6 +1089,8 @@ size_t rb_strftime(char *s, size_t maxsi https://github.com/ruby/ruby/blob/trunk/internal.h#L1089 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/