Skip to content

Commit

Permalink
lib: str_tabunescape() - optimize initial escape char lookup
Browse files Browse the repository at this point in the history
strchr() is faster than looping ourself.
  • Loading branch information
sirainen committed Nov 7, 2017
1 parent aa159ff commit fc45951
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/strescape.c
Expand Up @@ -201,10 +201,10 @@ char *str_tabunescape(char *str)
/* @UNSAFE */
char *dest, *start = str;

while (*str != '\001') {
if (*str == '\0')
return start;
str++;
str = strchr(str, '\001');
if (str == NULL) {
/* no unescaping needed */
return start;
}

for (dest = str; *str != '\0'; str++) {
Expand Down

0 comments on commit fc45951

Please sign in to comment.