aboutsummaryrefslogtreecommitdiff
path: root/strbuf.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 /strbuf.h
parent97e14d99f6def189b0f786ac6207b792ca3197b1 (diff)
parentf006e0323ee4b407bee3e0ff241d9d3f7a03b66a (diff)
downloadgit-5ce97021dd22751d0ab66dce4106dabc0463cdf0.tar.xz
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 'strbuf.h')
-rw-r--r--strbuf.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/strbuf.h b/strbuf.h
index 6362777c0a..a580ac6084 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -660,9 +660,9 @@ char *xstrvfmt(const char *fmt, va_list ap);
__attribute__((format (printf, 1, 2)))
char *xstrfmt(const char *fmt, ...);
-int starts_with(const char *str, const char *prefix);
-int istarts_with(const char *str, const char *prefix);
-int starts_with_mem(const char *str, size_t len, const char *prefix);
+bool starts_with(const char *str, const char *prefix);
+bool istarts_with(const char *str, const char *prefix);
+bool starts_with_mem(const char *str, size_t len, const char *prefix);
/*
* If the string "str" is the same as the string in "prefix", then the "arg"
@@ -678,16 +678,16 @@ int starts_with_mem(const char *str, size_t len, const char *prefix);
* can be used instead of !strcmp(arg, "--key") and then
* skip_prefix(arg, "--key=", &arg) to parse such an option.
*/
-int skip_to_optional_arg_default(const char *str, const char *prefix,
+bool skip_to_optional_arg_default(const char *str, const char *prefix,
const char **arg, const char *def);
-static inline int skip_to_optional_arg(const char *str, const char *prefix,
+static inline bool skip_to_optional_arg(const char *str, const char *prefix,
const char **arg)
{
return skip_to_optional_arg_default(str, prefix, arg, "");
}
-static inline int ends_with(const char *str, const char *suffix)
+static inline bool ends_with(const char *str, const char *suffix)
{
size_t len;
return strip_suffix(str, suffix, &len);