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
This commit is contained in:
Junio C Hamano
2025-07-24 16:03:55 -07:00
4 changed files with 29 additions and 26 deletions

View File

@@ -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)