Git fork

git-compat-util: convert string predicates to return bool

Since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}
to bool, 2023-12-16) a number of our string predicates have been
returning bool instead of int. Now that we've declared that experiment
a success, let's convert the return type of the case-independent
skip_iprefix() and skip_iprefix_mem() functions to match the return
type of their case-dependent equivalents. Returning bool instead of
int makes it clear that these functions are predicates.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Phillip Wood and committed by
Junio C Hamano
f3ba426e bfa405ea

+6 -6
+6 -6
git-compat-util.h
··· 895 * is done via tolower(), so it is strictly ASCII (no multi-byte characters or 896 * locale-specific conversions). 897 */ 898 - static inline int skip_iprefix(const char *str, const char *prefix, 899 const char **out) 900 { 901 do { 902 if (!*prefix) { 903 *out = str; 904 - return 1; 905 } 906 } while (tolower(*str++) == tolower(*prefix++)); 907 - return 0; 908 } 909 910 /* ··· 912 * comparison is done via tolower(), so it is strictly ASCII (no multi-byte 913 * characters or locale-specific conversions). 914 */ 915 - static inline int skip_iprefix_mem(const char *buf, size_t len, 916 const char *prefix, 917 const char **out, size_t *outlen) 918 { ··· 920 if (!*prefix) { 921 *out = buf; 922 *outlen = len; 923 - return 1; 924 } 925 } while (len-- > 0 && tolower(*buf++) == tolower(*prefix++)); 926 - return 0; 927 } 928 929 static inline int strtoul_ui(char const *s, int base, unsigned int *result)
··· 895 * is done via tolower(), so it is strictly ASCII (no multi-byte characters or 896 * locale-specific conversions). 897 */ 898 + static inline bool skip_iprefix(const char *str, const char *prefix, 899 const char **out) 900 { 901 do { 902 if (!*prefix) { 903 *out = str; 904 + return true; 905 } 906 } while (tolower(*str++) == tolower(*prefix++)); 907 + return false; 908 } 909 910 /* ··· 912 * comparison is done via tolower(), so it is strictly ASCII (no multi-byte 913 * characters or locale-specific conversions). 914 */ 915 + static inline bool skip_iprefix_mem(const char *buf, size_t len, 916 const char *prefix, 917 const char **out, size_t *outlen) 918 { ··· 920 if (!*prefix) { 921 *out = buf; 922 *outlen = len; 923 + return true; 924 } 925 } while (len-- > 0 && tolower(*buf++) == tolower(*prefix++)); 926 + return false; 927 } 928 929 static inline int strtoul_ui(char const *s, int base, unsigned int *result)