diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-02-04 03:16:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-02-04 03:16:50 +0000 |
commit | 383555fe4436de409516ccfa9adb2540db267b13 (patch) | |
tree | 4e253a6b53f04c07d78a5711f969c300a963ae1f /include/ruby | |
parent | 336fedc1edc2a0e7d1601f479765fa09d16d27c4 (diff) | |
download | ruby-383555fe4436de409516ccfa9adb2540db267b13.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/encoding.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index 5ea2cda116..ceedf0db65 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -232,7 +232,12 @@ int rb_enc_code_to_mbclen(int code, rb_encoding *enc); #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); |