diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-16 11:06:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-16 11:06:27 +0000 |
commit | ba20fe6289984abf051f86e4dae254dcb071c86e (patch) | |
tree | 8c42bd7e65369ec697a355fe0c52d9ea07f71d70 /string.c | |
parent | 7af3e9f08b6f277b7f96d7ed2a0115d1452d98cc (diff) |
* string.c (trnext): should advance char-wise.
[ruby-core:43335][Bug #6156]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -4956,13 +4956,13 @@ trnext(struct tr *t, rb_encoding *enc) for (;;) { if (!t->gen) { if (t->p == t->pend) return -1; - if (t->p < t->pend - 1 && *t->p == '\\') { - t->p++; + if (rb_enc_ascget(t->p, t->pend, &n, enc) == '\\') { + t->p += n; } t->now = rb_enc_codepoint_len(t->p, t->pend, &n, enc); t->p += n; - if (t->p < t->pend - 1 && *t->p == '-') { - t->p++; + if (rb_enc_ascget(t->p, t->pend, &n, enc) == '-') { + t->p += n; if (t->p < t->pend) { unsigned int c = rb_enc_codepoint_len(t->p, t->pend, &n, enc); t->p += n; |