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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-03-06 08:34:50 +00:00
Родитель 53fbaeab29
Коммит 62f20b9d58
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -3,7 +3,16 @@
* 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)