From 7598404ef03cbbfd0cec9a0c3e334dc7da3c4c65 Mon Sep 17 00:00:00 2001 From: Jay Howard Date: Mon, 3 Aug 2026 14:02:20 -0500 Subject: [PATCH] Avoid evaluating skip_vt102_codes twice per escape strip_vt102_codes() called skip_vt102_codes() once in the loop condition and again in the body to advance, so every escape sequence was classified twice. It runs on every incoming line (and on the whole output buffer), so cache the returned length and reuse it. Co-Authored-By: Claude Fable 5 --- src/vt102.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vt102.c b/src/vt102.c index a57dff2..0085097 100644 --- a/src/vt102.c +++ b/src/vt102.c @@ -586,15 +586,16 @@ int find_secure_color_code(char *str) int strip_vt102_codes(char *str, char *buf) { char *pti, *pto; + int skip; pti = (char *) str; pto = (char *) buf; while (*pti) { - while (skip_vt102_codes(pti)) + while ((skip = skip_vt102_codes(pti))) { - pti += skip_vt102_codes(pti); + pti += skip; } if (*pti)