aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-06-18 22:32:21 +0300
committerArnold D. Robbins <arnold@skeeve.com>2017-06-18 22:32:21 +0300
commit9ccddb999bb2d79c261702f789deb9371090a4ec (patch)
tree3ee11d8965d9a1ce0991baacb2a03523d21745fd /builtin.c
parent49f5a940d4290ee0ba0b4dd706237fbc8434b1d2 (diff)
parent4264c894681d11d4a5ce694aa8040223726fad1e (diff)
downloadegawk-9ccddb999bb2d79c261702f789deb9371090a4ec.tar.gz
egawk-9ccddb999bb2d79c261702f789deb9371090a4ec.tar.bz2
egawk-9ccddb999bb2d79c261702f789deb9371090a4ec.zip
Merge branch 'master' into feature/api-mpfr
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 b60d8b42..b3eda933 100644
--- a/builtin.c
+++ b/builtin.c
@@ -4154,12 +4154,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;