ruby-changes:46428
From: nobu <ko1@a...>
Date: Tue, 2 May 2017 16:35:26 +0900 (JST)
Subject: [ruby-changes:46428] nobu:r58540 (trunk): internal.h: rb_raise_static
nobu 2017-05-02 16:35:20 +0900 (Tue, 02 May 2017) New Revision: 58540 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58540 Log: internal.h: rb_raise_static * internal.h (rb_raise_static): raise with a static message string literal. Modified files: trunk/internal.h trunk/object.c Index: internal.h =================================================================== --- internal.h (revision 58539) +++ internal.h (revision 58540) @@ -1131,6 +1131,11 @@ PRINTF_ARGS(void rb_enc_warning(rb_encod https://github.com/ruby/ruby/blob/trunk/internal.h#L1131 PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3); PRINTF_ARGS(void rb_syserr_enc_warning(int err, rb_encoding *enc, const char *fmt, ...), 3, 4); +#define rb_raise_cstr(etype, mesg) \ + rb_exc_raise(rb_exc_new_str(etype, rb_str_new_cstr(mesg))) +#define rb_raise_static(etype, mesg) \ + rb_exc_raise(rb_exc_new_str(etype, rb_str_new_static(mesg, rb_strlen_lit(mesg)))) + VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method); #define rb_name_err_raise_str(mesg, recv, name) \ rb_exc_raise(rb_name_err_new(mesg, recv, name)) Index: object.c =================================================================== --- object.c (revision 58539) +++ object.c (revision 58540) @@ -2963,11 +2963,11 @@ rb_str_to_dbl(VALUE str, int badcheck) https://github.com/ruby/ruby/blob/trunk/object.c#L2963 #define special_const_to_float(val, pre, post) \ switch (val) { \ case Qnil: \ - rb_raise(rb_eTypeError, pre "nil" post); \ + rb_raise_static(rb_eTypeError, pre "nil" post); \ case Qtrue: \ - rb_raise(rb_eTypeError, pre "true" post); \ + rb_raise_static(rb_eTypeError, pre "true" post); \ case Qfalse: \ - rb_raise(rb_eTypeError, pre "false" post); \ + rb_raise_static(rb_eTypeError, pre "false" post); \ } static inline void -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/