Skip to content

Commit acd92bb

Browse files
author
Mikhail Ilyin
committed
Fix trim function
1 parent e58a77b commit acd92bb

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/ws.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,7 @@ static void trim(char *p)
289289
{
290290
size_t n = strlen(p);
291291

292-
if (!n)
293-
return;
294-
295-
while (isspace(p[n-1]))
292+
while (n > 0 && isspace(p[n-1]))
296293
p[--n] = 0;
297294
}
298295

0 commit comments

Comments
 (0)