ruby-changes:41933
From: nobu <ko1@a...>
Date: Sun, 6 Mar 2016 17:34:55 +0900 (JST)
Subject: [ruby-changes:41933] nobu:r54007 (trunk): eval_error.c: trivial optimization
nobu 2016-03-06 17:34:50 +0900 (Sun, 06 Mar 2016) New Revision: 54007 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54007 Log: eval_error.c: trivial optimization * eval_error.c (warn_print): optimize warn_print with a string literal, with rb_write_error2 instead of rb_write_error. Modified files: trunk/eval_error.c Index: eval_error.c =================================================================== --- eval_error.c (revision 54006) +++ eval_error.c (revision 54007) @@ -3,7 +3,16 @@ https://github.com/ruby/ruby/blob/trunk/eval_error.c#L3 * included by eval.c */ +#if defined(__GNUC__) && !defined(__PCC__) +#define warn_print(x) __extension__ ( \ +{ \ + (__builtin_constant_p(x)) ? \ + rb_write_error2((x), (long)strlen(x)) : \ + rb_write_error(x); \ +}) +#else #define warn_print(x) rb_write_error(x) +#endif #define warn_print2(x,l) rb_write_error2((x),(l)) #define warn_print_str(x) rb_write_error_str(x) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/