Skip to content

Commit

Permalink
Revert using strchr instead of loop
Browse files Browse the repository at this point in the history
Change made in 012facd
  • Loading branch information
andy5995 committed Feb 26, 2024
1 parent 5db7cb9 commit 9167c88
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions canfigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,11 @@ truncate_whitespace(char *str)
return;

char *pos_0 = str;
/* Advance pointer until NULL terminator is found */
str = strchr(str, '\0');
/* Advance pointer until NULL terminator is found
* Don't try to use strchr() because you'll get a different
* result if the pointer is already at '\0'. */
while (*str != '\0')
str++;

/* set pointer to segment preceding NULL terminator */
if (str != pos_0)
Expand Down

0 comments on commit 9167c88

Please sign in to comment.