aboutsummaryrefslogtreecommitdiffstats
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-07-24 16:03:55 -0700
committerJunio C Hamano <gitster@pobox.com>2025-07-24 16:03:55 -0700
commit5ce97021dd22751d0ab66dce4106dabc0463cdf0 (patch)
tree215cea90bb92d71861135ab2b1a6b75ab9f34962 /git-compat-util.h
parentThe thirteenth batch (diff)
parentstrbuf: convert predicates to return bool (diff)
downloadgit-5ce97021dd22751d0ab66dce4106dabc0463cdf0.tar.gz
git-5ce97021dd22751d0ab66dce4106dabc0463cdf0.zip
Merge branch 'pw/adopt-c99-bool-officially'
Declare weather-balloon we raised for "bool" type 18 months ago a success and officially allow using the type in our codebase. * pw/adopt-c99-bool-officially: strbuf: convert predicates to return bool git-compat-util: convert string predicates to return bool CodingGuidelines: allow the use of bool
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 5bd69ec040..9408f463e3 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -897,16 +897,16 @@ static inline size_t xsize_t(off_t len)
* is done via tolower(), so it is strictly ASCII (no multi-byte characters or
* locale-specific conversions).
*/
-static inline int skip_iprefix(const char *str, const char *prefix,
+static inline bool skip_iprefix(const char *str, const char *prefix,
const char **out)
{
do {
if (!*prefix) {
*out = str;
- return 1;
+ return true;
}
} while (tolower(*str++) == tolower(*prefix++));
- return 0;
+ return false;
}
/*
@@ -914,7 +914,7 @@ static inline int skip_iprefix(const char *str, const char *prefix,
* comparison is done via tolower(), so it is strictly ASCII (no multi-byte
* characters or locale-specific conversions).
*/
-static inline int skip_iprefix_mem(const char *buf, size_t len,
+static inline bool skip_iprefix_mem(const char *buf, size_t len,
const char *prefix,
const char **out, size_t *outlen)
{
@@ -922,10 +922,10 @@ static inline int skip_iprefix_mem(const char *buf, size_t len,
if (!*prefix) {
*out = buf;
*outlen = len;
- return 1;
+ return true;
}
} while (len-- > 0 && tolower(*buf++) == tolower(*prefix++));
- return 0;
+ return false;
}
static inline int strtoul_ui(char const *s, int base, unsigned int *result)