From e42f3b36f91c864138113ba7ead073b55d02293b Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 11 Jan 2024 11:49:49 +0900 Subject: [PATCH] string.c (chars2bytes): simplify the condition to detect break --- src/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/string.c b/src/string.c index 14f6433c4..085c2daa2 100644 --- a/src/string.c +++ b/src/string.c @@ -340,7 +340,7 @@ chars2bytes(mrb_value s, mrb_int off, mrb_int idx) } mrb_int len = (mrb_int)(p-p0); - if (idx > 0 || p > e) len++; + if (idx > 0) len++; return len; }