Mercurial > hg > th-libs
diff th_strglob.c @ 735:31bc1ed07cf5
Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 07 Dec 2022 12:14:39 +0200 |
parents | 29e44a58bc73 |
children | 600a3c08747f |
line wrap: on
line diff
--- a/th_strglob.c Wed Dec 07 11:58:54 2022 +0200 +++ b/th_strglob.c Wed Dec 07 12:14:39 2022 +0200 @@ -6,14 +6,14 @@ * Please read file 'COPYING' for information on license and distribution. */ -BOOL TH_STRGLOB_FUNC (const char *haystack, const char *pattern) +bool TH_STRGLOB_FUNC (const char *haystack, const char *pattern) { - BOOL matched = TRUE, any = FALSE, end = FALSE; + bool matched = true, any = false, end = false; const char *tmp = NULL; // Check given pattern and string if (haystack == NULL || pattern == NULL) - return FALSE; + return false; // Start comparision while (matched && !end) @@ -27,14 +27,14 @@ haystack++; } else - matched = FALSE; + matched = false; break; case '*': pattern++; if (!*pattern || *pattern == '?') - end = TRUE; - any = TRUE; + end = true; + any = true; tmp = pattern; break; @@ -44,37 +44,37 @@ if (*haystack) haystack++; else - end = TRUE; + end = true; } else if (*haystack) { if (tmp) { - any = TRUE; + any = true; pattern = tmp; } else - matched = FALSE; + matched = false; } else - end = TRUE; + end = true; break; default: { - BOOL equals = TH_STRGLOB_COLLATE(*pattern) == TH_STRGLOB_COLLATE(*haystack); + bool equals = TH_STRGLOB_COLLATE(*pattern) == TH_STRGLOB_COLLATE(*haystack); if (any) { if (equals) { - any = FALSE; + any = false; } else if (*haystack) haystack++; else - matched = FALSE; + matched = false; } else { @@ -88,15 +88,15 @@ else if (tmp) { - any = TRUE; + any = true; pattern = tmp; } else - matched = FALSE; + matched = false; } if (!*haystack && !*pattern) - end = TRUE; + end = true; } break; }