aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-17 06:39:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-17 06:39:29 +0000
commitda6997ef13787ca3677e2413fd3bbf0553c057f6 (patch)
tree5076445f82418943ada0f01b50f7eef909ebd85b /re.c
parentcc4c9a2f43e1cf80328fa720f4c3401e07f61b57 (diff)
downloadruby-da6997ef13787ca3677e2413fd3bbf0553c057f6.tar.gz
encoding.h: ENC_CODERANGE_CLEAN_P
* include/ruby/encoding.h (ENC_CODERANGE_CLEAN_P): predicate that tells if the coderange is clean, that is 7bit or valid, and no needs to scrub. * re.c (rb_reg_expr_str): use ENC_CODERANGE_CLEAN_P. * string.c (enc_strlen, rb_enc_cr_str_buf_cat, rb_str_scrub): ditto. * string.c (rb_str_enumerate_chars): ditto, and suppress a warning by gcc6. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/re.c b/re.c
index 7c925c6ba7..bceec15f0a 100644
--- a/re.c
+++ b/re.c
@@ -340,8 +340,7 @@ rb_reg_expr_str(VALUE str, const char *s, long len,
p = s; pend = p + len;
rb_str_coderange_scan_restartable(p, pend, enc, &cr);
- if (rb_enc_asciicompat(enc) &&
- (cr == ENC_CODERANGE_VALID || cr == ENC_CODERANGE_7BIT)) {
+ if (rb_enc_asciicompat(enc) && ENC_CODERANGE_CLEAN_P(cr)) {
while (p < pend) {
c = rb_enc_ascget(p, pend, &clen, enc);
if (c == -1) {