Mercurial > hg > th-libs
changeset 702:5653e386730b
Fix th_strpbrk().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 10 Mar 2020 23:37:22 +0200 |
parents | d687bbb54c1a |
children | dbc71c000376 |
files | th_string.c |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/th_string.c Tue Mar 10 21:06:09 2020 +0200 +++ b/th_string.c Tue Mar 10 23:37:22 2020 +0200 @@ -14,15 +14,15 @@ /** * Implementation of strchr() for th_char_t. - * @param[in] src string to find 'ch' from + * @param[in] src string to find @p valid from * @returns pointer to the match position, NULL if no match found */ -th_char_t *th_strchr(const th_char_t *str, const th_char_t ch) +th_char_t *th_strchr(const th_char_t *str, const th_char_t valid) { - for (th_char_t *p = (th_char_t *) str; *p; p++) + for (th_char_t *ch = (th_char_t *) str; *ch; ch++) { - if (*p == ch) - return p; + if (*ch == valid) + return ch; } return NULL; } @@ -35,12 +35,12 @@ */ th_char_t *th_strpbrk(const th_char_t *str, const th_char_t *valid) { - for (th_char_t *p = (th_char_t *) str; *p; p++) + for (th_char_t *ch = (th_char_t *) str; *ch; ch++) { - for (const th_char_t *ch = valid; *valid; valid++) + for (const th_char_t *cmp = valid; *cmp; cmp++) { - if (*p == *ch) - return p; + if (*ch == *cmp) + return ch; } } return NULL;