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>

Phillip Wood committed Jul 16, 2025 at 10:38 UTC f3ba426e3539b2d585944f9d6425dbc13b7d0d28
1 file changed +6 -6
git-compat-util.h
+6 -6
@@ -895,16 +895,16 @@ static inline size_t xsize_t(off_t len)
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,
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 1;
904 + return true;
905 }
906 } while (tolower(*str++) == tolower(*prefix++));
907 - return 0;
907 + return false;
908 }
909
910 /*
@@ -912,7 +912,7 @@ static inline int skip_iprefix(const char *str, const char *prefix,
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,
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,10 +920,10 @@ static inline int skip_iprefix_mem(const char *buf, size_t len,
920 if (!*prefix) {
921 *out = buf;
922 *outlen = len;
923 - return 1;
923 + return true;
924 }
925 } while (len-- > 0 && tolower(*buf++) == tolower(*prefix++));
926 - return 0;
926 + return false;
927 }
928
929 static inline int strtoul_ui(char const *s, int base, unsigned int *result)