mirror of
https://github.com/scandum/tintin
synced 2026-08-13 20:23:04 -04:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
07969f5310
commit
7598404ef0
1 changed files with 3 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue