Merge pull request #6478 from dearblue/chars2bytes

This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-02-27 10:32:55 +09:00
committed by GitHub
+3 -2
View File
@@ -465,9 +465,10 @@ chars2bytes(mrb_value str, mrb_int off, mrb_int idx)
return idx;
}
const char *p0 = RSTR_PTR(s) + off;
const char *o = RSTR_PTR(s);
const char *p0 = o + off;
const char *p = p0;
const char *e = p0 + RSTR_LEN(s);
const char *e = o + RSTR_LEN(s);
mrb_int i = 0;
while (p<e && i<idx) {