aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-06-18 22:32:40 +0300
committerArnold D. Robbins <arnold@skeeve.com>2017-06-18 22:32:40 +0300
commit231cb5df34699fd98001e2e124d73da5d2f795f9 (patch)
tree204041cc511e4881babfd02e94841c91f143371e /builtin.c
parentd8332ae3fad279790df98ef8422cad916454ea4b (diff)
parent4264c894681d11d4a5ce694aa8040223726fad1e (diff)
downloadegawk-231cb5df34699fd98001e2e124d73da5d2f795f9.tar.gz
egawk-231cb5df34699fd98001e2e124d73da5d2f795f9.tar.bz2
egawk-231cb5df34699fd98001e2e124d73da5d2f795f9.zip
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin.c b/builtin.c
index 87d9dcb8..724be058 100644
--- a/builtin.c
+++ b/builtin.c
@@ -4152,12 +4152,13 @@ mbc_char_count(const char *ptr, size_t numbytes)
if (mb_len <= 0)
return numbytes; /* no valid m.b. char */
- for (; numbytes > 0; numbytes--) {
+ while (numbytes > 0) {
mb_len = mbrlen(ptr, numbytes, &cur_state);
if (mb_len <= 0)
break;
sum++;
ptr += mb_len;
+ numbytes -= mb_len;
}
return sum;