ruby-changes:41656
From: nobu <ko1@a...>
Date: Thu, 4 Feb 2016 12:16:50 +0900 (JST)
Subject: [ruby-changes:41656] nobu:r53730 (trunk): encoding.h: rb_enc_asciicompat_inline
nobu 2016-02-04 12:16:50 +0900 (Thu, 04 Feb 2016) New Revision: 53730 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53730 Log: encoding.h: rb_enc_asciicompat_inline * include/ruby/encoding.h (rb_enc_asciicompat): turn into an inline function to get rid of evalucating the argument twice. Modified files: trunk/include/ruby/encoding.h Index: include/ruby/encoding.h =================================================================== --- include/ruby/encoding.h (revision 53729) +++ include/ruby/encoding.h (revision 53730) @@ -232,7 +232,12 @@ int rb_enc_code_to_mbclen(int code, rb_e https://github.com/ruby/ruby/blob/trunk/include/ruby/encoding.h#L232 #define rb_enc_isspace(c,enc) ONIGENC_IS_CODE_SPACE((enc),(c)) #define rb_enc_isdigit(c,enc) ONIGENC_IS_CODE_DIGIT((enc),(c)) -#define rb_enc_asciicompat(enc) (rb_enc_mbminlen(enc)==1 && !rb_enc_dummy_p(enc)) +static inline int +rb_enc_asciicompat_inline(rb_encoding *enc) +{ + return rb_enc_mbminlen(enc)==1 && !rb_enc_dummy_p(enc); +} +#define rb_enc_asciicompat(enc) rb_enc_asciicompat_inline(enc) int rb_enc_casefold(char *to, const char *p, const char *e, rb_encoding *enc); int rb_enc_toupper(int c, rb_encoding *enc); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/