{"thread":{"id":"63791","subject":"[PATCH 0/3] C99: declare bool experiment a success","startedAt":"2025-07-14T13:27:26Z","lastAt":"2025-07-22T08:09:32Z","messageCount":33,"participants":["Phillip Wood","Junio C Hamano","Eric Sunshine","Elijah Newren","brian m. carlson","rsbecker@nexbridge.com","Jeff King","Karthik Nayak"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"521893","messageId":"cover.1752499610.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":null,"subject":"[PATCH 0/3] C99: declare bool experiment a success","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-14T13:26:59Z","receivedAt":"2025-07-14T13:27:26Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nWe've had a test balloon for C99's bool type since 8277dbe987\n(git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n2023-12-16). As it has been over 18 months since this was added and\nthere have been no complaints let's declare it a success and convert\nthe return type our other string predicates to match.\n\nBase-Commit: a30f80fde927d70950b3b4d1820813480968fb0d\nPublished-As: https://github.com/phillipwood/git/releases/tag/pw%2Fuse-c99-bool%2Fv1\nView-Changes-At: https://github.com/phillipwood/git/compare/a30f80fde...7eaf80420\nFetch-It-Via: git fetch https://github.com/phillipwood/git pw/use-c99-bool/v1\n\n\nPhillip Wood (3):\n  CodingGuildlines: allow the use of bool\n  git-compat-util: convert string predicates to return bool\n  strbuf: convert predicates to return bool\n\n Documentation/CodingGuidelines |  3 +++\n git-compat-util.h              | 12 ++++++------\n strbuf.c                       | 28 ++++++++++++++--------------\n strbuf.h                       | 12 ++++++------\n 4 files changed, 29 insertions(+), 26 deletions(-)\n\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"521894","messageId":"352f80c49b74053d611e7d64991fed1c16d857a4.1752499610.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752499610.git.phillip.wood@dunelm.org.uk","subject":"[PATCH 1/3] CodingGuildlines: allow the use of bool","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-14T13:27:00Z","receivedAt":"2025-07-14T13:27:27Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nWe have had a test balloon for C99's bool type since 8277dbe987\n(git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n2023-12-16). As we've had it over 18 months without any complaints\nlet's declare it a success.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n Documentation/CodingGuidelines | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines\nindex 6350949f2ef..528b42d1dd1 100644\n--- a/Documentation/CodingGuidelines\n+++ b/Documentation/CodingGuidelines\n@@ -298,6 +298,9 @@ For C programs:\n    . since late 2021 with 44ba10d6, we have had variables declared in\n      the for loop \"for (int i = 0; i < 10; i++)\".\n \n+   . since late 2023 with 8277dbe987 we have been using the bool type\n+     from <stdbool.h>.\n+\n    New C99 features that we cannot use yet:\n \n    . %z and %zu as a printf() argument for a size_t (the %z being for\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"521895","messageId":"a0f9182aa20d0f956072a3d185a2d1288f1bd842.1752499610.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752499610.git.phillip.wood@dunelm.org.uk","subject":"[PATCH 2/3] git-compat-util: convert string predicates to return bool","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-14T13:27:01Z","receivedAt":"2025-07-14T13:27:27Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nSince 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\nto bool, 2023-12-16) a number of our sting predicates have been\nreturning bool instead of int. Now we've declared that experiment\na success lets convert the return type the case independent\nskip_iprefix() and skip_iprefix_mem() functions to match the return\ntype of their case dependent equivalents. Returning bool instead of\nint makes it clear that these functions are predicates.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n git-compat-util.h | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 5bd69ec0403..9408f463e31 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -897,35 +897,35 @@ static inline size_t xsize_t(off_t len)\n  * is done via tolower(), so it is strictly ASCII (no multi-byte characters or\n  * locale-specific conversions).\n  */\n-static inline int skip_iprefix(const char *str, const char *prefix,\n+static inline bool skip_iprefix(const char *str, const char *prefix,\n \t\t\t       const char **out)\n {\n \tdo {\n \t\tif (!*prefix) {\n \t\t\t*out = str;\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\t}\n \t} while (tolower(*str++) == tolower(*prefix++));\n-\treturn 0;\n+\treturn false;\n }\n \n /*\n  * Like skip_prefix_mem, but compare case-insensitively. Note that the\n  * comparison is done via tolower(), so it is strictly ASCII (no multi-byte\n  * characters or locale-specific conversions).\n  */\n-static inline int skip_iprefix_mem(const char *buf, size_t len,\n+static inline bool skip_iprefix_mem(const char *buf, size_t len,\n \t\t\t\t   const char *prefix,\n \t\t\t\t   const char **out, size_t *outlen)\n {\n \tdo {\n \t\tif (!*prefix) {\n \t\t\t*out = buf;\n \t\t\t*outlen = len;\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\t}\n \t} while (len-- > 0 && tolower(*buf++) == tolower(*prefix++));\n-\treturn 0;\n+\treturn false;\n }\n \n static inline int strtoul_ui(char const *s, int base, unsigned int *result)\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"521896","messageId":"7eaf80420611aab498089a2bddead892330606b8.1752499610.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752499610.git.phillip.wood@dunelm.org.uk","subject":"[PATCH 3/3] strbuf: convert predicates to return bool","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-14T13:27:02Z","receivedAt":"2025-07-14T13:27:28Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nNow that the string predicates defined in git-compat-util.h all\nreturn bool let's convert the return type of the string predicates\nin strbuf.{c,h} to match them.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n strbuf.c | 28 ++++++++++++++--------------\n strbuf.h | 12 ++++++------\n 2 files changed, 20 insertions(+), 20 deletions(-)\n\ndiff --git a/strbuf.c b/strbuf.c\nindex f30fdc69843..6c3851a7f84 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -8,55 +8,55 @@\n #include \"utf8.h\"\n #include \"date.h\"\n \n-int starts_with(const char *str, const char *prefix)\n+bool starts_with(const char *str, const char *prefix)\n {\n \tfor (; ; str++, prefix++)\n \t\tif (!*prefix)\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\telse if (*str != *prefix)\n-\t\t\treturn 0;\n+\t\t\treturn false;\n }\n \n-int istarts_with(const char *str, const char *prefix)\n+bool istarts_with(const char *str, const char *prefix)\n {\n \tfor (; ; str++, prefix++)\n \t\tif (!*prefix)\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\telse if (tolower(*str) != tolower(*prefix))\n-\t\t\treturn 0;\n+\t\t\treturn false;\n }\n \n-int starts_with_mem(const char *str, size_t len, const char *prefix)\n+bool starts_with_mem(const char *str, size_t len, const char *prefix)\n {\n \tconst char *end = str + len;\n \tfor (; ; str++, prefix++) {\n \t\tif (!*prefix)\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\telse if (str == end || *str != *prefix)\n-\t\t\treturn 0;\n+\t\t\treturn false;\n \t}\n }\n \n-int skip_to_optional_arg_default(const char *str, const char *prefix,\n+bool skip_to_optional_arg_default(const char *str, const char *prefix,\n \t\t\t\t const char **arg, const char *def)\n {\n \tconst char *p;\n \n \tif (!skip_prefix(str, prefix, &p))\n-\t\treturn 0;\n+\t\treturn false;\n \n \tif (!*p) {\n \t\tif (arg)\n \t\t\t*arg = def;\n-\t\treturn 1;\n+\t\treturn true;\n \t}\n \n \tif (*p != '=')\n-\t\treturn 0;\n+\t\treturn false;\n \n \tif (arg)\n \t\t*arg = p + 1;\n-\treturn 1;\n+\treturn true;\n }\n \n /*\ndiff --git a/strbuf.h b/strbuf.h\nindex 6362777c0a0..a580ac6084b 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -660,9 +660,9 @@ char *xstrvfmt(const char *fmt, va_list ap);\n __attribute__((format (printf, 1, 2)))\n char *xstrfmt(const char *fmt, ...);\n \n-int starts_with(const char *str, const char *prefix);\n-int istarts_with(const char *str, const char *prefix);\n-int starts_with_mem(const char *str, size_t len, const char *prefix);\n+bool starts_with(const char *str, const char *prefix);\n+bool istarts_with(const char *str, const char *prefix);\n+bool starts_with_mem(const char *str, size_t len, const char *prefix);\n \n /*\n  * If the string \"str\" is the same as the string in \"prefix\", then the \"arg\"\n@@ -678,16 +678,16 @@ int starts_with_mem(const char *str, size_t len, const char *prefix);\n  * can be used instead of !strcmp(arg, \"--key\") and then\n  * skip_prefix(arg, \"--key=\", &arg) to parse such an option.\n  */\n-int skip_to_optional_arg_default(const char *str, const char *prefix,\n+bool skip_to_optional_arg_default(const char *str, const char *prefix,\n \t\t\t\t const char **arg, const char *def);\n \n-static inline int skip_to_optional_arg(const char *str, const char *prefix,\n+static inline bool skip_to_optional_arg(const char *str, const char *prefix,\n \t\t\t\t       const char **arg)\n {\n \treturn skip_to_optional_arg_default(str, prefix, arg, \"\");\n }\n \n-static inline int ends_with(const char *str, const char *suffix)\n+static inline bool ends_with(const char *str, const char *suffix)\n {\n \tsize_t len;\n \treturn strip_suffix(str, suffix, &len);\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"521906","messageId":"xmqqv7nuu3sj.fsf@gitster.g","threadId":"63791","inReplyTo":"352f80c49b74053d611e7d64991fed1c16d857a4.1752499610.git.phillip.wood@dunelm.org.uk","subject":"Re: [PATCH 1/3] CodingGuildlines: allow the use of bool","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-14T16:37:32Z","receivedAt":"2025-07-14T16:37:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>\n> We have had a test balloon for C99's bool type since 8277dbe987\n> (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n> 2023-12-16). As we've had it over 18 months without any complaints\n> let's declare it a success.\n>\n> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n> ---\n>  Documentation/CodingGuidelines | 3 +++\n>  1 file changed, 3 insertions(+)\n>\n> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines\n> index 6350949f2ef..528b42d1dd1 100644\n> --- a/Documentation/CodingGuidelines\n> +++ b/Documentation/CodingGuidelines\n> @@ -298,6 +298,9 @@ For C programs:\n>     . since late 2021 with 44ba10d6, we have had variables declared in\n>       the for loop \"for (int i = 0; i < 10; i++)\".\n>  \n> +   . since late 2023 with 8277dbe987 we have been using the bool type\n> +     from <stdbool.h>.\n\nLet's see the other ones in the same list.\n\n * initializer elements that are not static (used since 2b6854c8\n   (Cleanup variables in cat-file, 2007-04-21), declared official\n   with 442c27dd (CodingGuidelines: mention dynamic C99 initializer\n   elements, 2022-10-10).\n\n * trailing comma in enum definition (used since e1327023 (grep:\n   refactor the concept of \"grep source\" into an object,\n   2012-02-02), declared official with cc0c4297 (CodingGuidelines:\n   spell out post-C89 rules, 2019-07-16).\n\n * designated initialiers for struct and arrays (used since cbc0f81d\n   (strbuf: use designated initializers in STRBUF_INIT, 2017-07-10)\n   and 512f41cf (clean.c: use designated initializer, 2017-07-14),\n   declared official with cc0c4297 (CodingGuidelines: spell out\n   post-C89 rules, 2019-07-16).\n\n * variadic macros (used since 765dc168 (git-compat-util: always\n   enable variadic macros, 2021-01-28), declared official with\n   56a29d2c (C99: remove hardcoded-out !HAVE_VARIADIC_MACROS code,\n   2022-02-21).\n\n * declaring a control variable in for(;;) loop (used since 44ba10d6\n   (revision: use C99 declaration of variable in for() loop,\n   2021-11-14), declared official with 82dd01d8 (CodingGuidelines:\n   allow declaring variables in for loops, 2022-10-10).\n\nA year and a half sounds roughly the average timespan.\n\nWill queue.  Thanks.\n\n\n"},{"id":"521908","messageId":"CAPig+cS=tEO90WnATueFM8FumHcq9HkPrfa_JUCzeMkDaLsYdw@mail.gmail.com","threadId":"63791","inReplyTo":"a0f9182aa20d0f956072a3d185a2d1288f1bd842.1752499610.git.phillip.wood@dunelm.org.uk","subject":"Re: [PATCH 2/3] git-compat-util: convert string predicates to return bool","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2025-07-14T16:46:02Z","receivedAt":"2025-07-14T16:46:14Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Mon, Jul 14, 2025 at 9:31 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n> Since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\n> to bool, 2023-12-16) a number of our sting predicates have been\n\ns/sting/string/\n\n> returning bool instead of int. Now we've declared that experiment\n> a success lets convert the return type the case independent\n\ns/lets/let's/\n/type/& of/\n\n> skip_iprefix() and skip_iprefix_mem() functions to match the return\n> type of their case dependent equivalents. Returning bool instead of\n> int makes it clear that these functions are predicates.\n>\n> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n"},{"id":"521918","messageId":"CABPp-BEH9rtdPcS9hEXSdCqwydcWbakT59OuQOFUU7DGjPzdVw@mail.gmail.com","threadId":"63791","inReplyTo":"a0f9182aa20d0f956072a3d185a2d1288f1bd842.1752499610.git.phillip.wood@dunelm.org.uk","subject":"Re: [PATCH 2/3] git-compat-util: convert string predicates to return bool","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2025-07-14T17:20:08Z","receivedAt":"2025-07-14T17:20:20Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, Jul 14, 2025 at 6:32 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n>\n> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>\n> Since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\n> to bool, 2023-12-16) a number of our sting predicates have been\n> returning bool instead of int. Now we've declared that experiment\n\nNow we've -> Now that we've\n\n> a success lets convert the return type the case independent\n\nsuccess lets -> success, let's\ntype the -> type of the\n\n> skip_iprefix() and skip_iprefix_mem() functions to match the return\n> type of their case dependent equivalents. Returning bool instead of\n\nI wonder if case-independent and case-dependent should be hyphenated,\nor as separate words as you had them.  Anyone know?\n\n> int makes it clear that these functions are predicates.\n>\n> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n> ---\n>  git-compat-util.h | 12 ++++++------\n>  1 file changed, 6 insertions(+), 6 deletions(-)\n>\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index 5bd69ec0403..9408f463e31 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -897,35 +897,35 @@ static inline size_t xsize_t(off_t len)\n>   * is done via tolower(), so it is strictly ASCII (no multi-byte characters or\n>   * locale-specific conversions).\n>   */\n> -static inline int skip_iprefix(const char *str, const char *prefix,\n> +static inline bool skip_iprefix(const char *str, const char *prefix,\n>                                const char **out)\n>  {\n>         do {\n>                 if (!*prefix) {\n>                         *out = str;\n> -                       return 1;\n> +                       return true;\n>                 }\n>         } while (tolower(*str++) == tolower(*prefix++));\n> -       return 0;\n> +       return false;\n>  }\n>\n>  /*\n>   * Like skip_prefix_mem, but compare case-insensitively. Note that the\n>   * comparison is done via tolower(), so it is strictly ASCII (no multi-byte\n>   * characters or locale-specific conversions).\n>   */\n> -static inline int skip_iprefix_mem(const char *buf, size_t len,\n> +static inline bool skip_iprefix_mem(const char *buf, size_t len,\n>                                    const char *prefix,\n>                                    const char **out, size_t *outlen)\n>  {\n>         do {\n>                 if (!*prefix) {\n>                         *out = buf;\n>                         *outlen = len;\n> -                       return 1;\n> +                       return true;\n>                 }\n>         } while (len-- > 0 && tolower(*buf++) == tolower(*prefix++));\n> -       return 0;\n> +       return false;\n>  }\n>\n>  static inline int strtoul_ui(char const *s, int base, unsigned int *result)\n> --\n> 2.49.0.897.gfad3eb7d210\n\nPatch looks good.\n"},{"id":"521922","messageId":"aHVzJE9_xJAn5dOt@fruit.crustytoothpaste.net","threadId":"63791","inReplyTo":"CABPp-BEH9rtdPcS9hEXSdCqwydcWbakT59OuQOFUU7DGjPzdVw@mail.gmail.com","subject":"Re: [PATCH 2/3] git-compat-util: convert string predicates to return bool","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2025-07-14T21:14:12Z","receivedAt":"2025-07-14T21:14:20Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2025-07-14 at 17:20:08, Elijah Newren wrote:\n> On Mon, Jul 14, 2025 at 6:32 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n> >\n> > From: Phillip Wood <phillip.wood@dunelm.org.uk>\n> >\n> > Since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\n> > to bool, 2023-12-16) a number of our sting predicates have been\n> > returning bool instead of int. Now we've declared that experiment\n> \n> Now we've -> Now that we've\n> \n> > a success lets convert the return type the case independent\n> \n> success lets -> success, let's\n> type the -> type of the\n> \n> > skip_iprefix() and skip_iprefix_mem() functions to match the return\n> > type of their case dependent equivalents. Returning bool instead of\n> \n> I wonder if case-independent and case-dependent should be hyphenated,\n> or as separate words as you had them.  Anyone know?\n\nI would hyphenate them.  The Chicago Manual of Style, 18th Edition, says\nin § 7.91, “When compound modifiers (also called phrasal adjectives)\nsuch as _high-profile_ or _book-length_ precede a noun, hyphenation\nusually lends clarity.  With the exception of proper nouns (such as\n_United States_) and compounds formed by an adverb ending in _-ly_ plus\nan adjective…, it is never incorrect to hyphenate adjectival compounds\nbefore a noun.”\n\nThey go on to state that hyphenation is usually omitted _after_ a noun.\n\nI usually follow this rule in my writing and commit messages and I\nhaven't gotten any complaints or comments about it, for what it's worth.\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"},{"id":"521955","messageId":"1a00924e-6e2c-4758-8fe9-2c04f5935fbf@gmail.com","threadId":"63791","inReplyTo":"aHVzJE9_xJAn5dOt@fruit.crustytoothpaste.net","subject":"Re: [PATCH 2/3] git-compat-util: convert string predicates to return bool","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-15T09:36:53Z","receivedAt":"2025-07-15T09:36:59Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 14/07/2025 22:14, brian m. carlson wrote:\n> On 2025-07-14 at 17:20:08, Elijah Newren wrote:\n>> On Mon, Jul 14, 2025 at 6:32 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n>>>\n>> I wonder if case-independent and case-dependent should be hyphenated,\n>> or as separate words as you had them.  Anyone know?\n> \n> I would hyphenate them.  The Chicago Manual of Style, 18th Edition, says\n> in § 7.91, “When compound modifiers (also called phrasal adjectives)\n> such as _high-profile_ or _book-length_ precede a noun, hyphenation\n> usually lends clarity.  With the exception of proper nouns (such as\n> _United States_) and compounds formed by an adverb ending in _-ly_ plus\n> an adjective…, it is never incorrect to hyphenate adjectival compounds\n> before a noun.”\n> \n> They go on to state that hyphenation is usually omitted _after_ a noun.\n> \n> I usually follow this rule in my writing and commit messages and I\n> haven't gotten any complaints or comments about it, for what it's worth.\n\nThanks for that - I'll hyphenate them then.\n\nThank you also to Elijah and Eric for the typo fixes - I seem to have \nhad my brain turned off when I proofread this message.\n\nPhillip\n"},{"id":"521993","messageId":"cover.1752587571.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752499610.git.phillip.wood@dunelm.org.uk","subject":"[PATCH v2 0/3] C99: declare bool experiment a success","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-15T13:52:49Z","receivedAt":"2025-07-15T13:53:13Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nWe've had a test balloon for C99's bool type since 8277dbe987\n(git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n2023-12-16). As it has been over 18 months since this was added and\nthere have been no complaints let's declare it a success and convert\nthe return type our other string predicates to match.\n\nThank you to everyone who commented on V1, the only change here is\nto fix the typos in the commit message for patch 2.\n\nBase-Commit: a30f80fde927d70950b3b4d1820813480968fb0d\nPublished-As: https://github.com/phillipwood/git/releases/tag/pw%2Fuse-c99-bool%2Fv2\nView-Changes-At: https://github.com/phillipwood/git/compare/a30f80fde...669687147\nFetch-It-Via: git fetch https://github.com/phillipwood/git pw/use-c99-bool/v2\n\n\nPhillip Wood (3):\n  CodingGuildlines: allow the use of bool\n  git-compat-util: convert string predicates to return bool\n  strbuf: convert predicates to return bool\n\n Documentation/CodingGuidelines |  3 +++\n git-compat-util.h              | 12 ++++++------\n strbuf.c                       | 28 ++++++++++++++--------------\n strbuf.h                       | 12 ++++++------\n 4 files changed, 29 insertions(+), 26 deletions(-)\n\nRange-diff against v1:\n1:  352f80c49b7 = 1:  352f80c49b7 CodingGuildlines: allow the use of bool\n2:  a0f9182aa20 ! 2:  0b2402e11cc git-compat-util: convert string predicates to return bool\n    @@ Commit message\n         git-compat-util: convert string predicates to return bool\n     \n         Since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\n    -    to bool, 2023-12-16) a number of our sting predicates have been\n    -    returning bool instead of int. Now we've declared that experiment\n    -    a success lets convert the return type the case independent\n    +    to bool, 2023-12-16) a number of our string predicates have been\n    +    returning bool instead of int. Now that we've declared that experiment\n    +    a success, let's convert the return type of the case-independent\n         skip_iprefix() and skip_iprefix_mem() functions to match the return\n    -    type of their case dependent equivalents. Returning bool instead of\n    +    type of their case-dependent equivalents. Returning bool instead of\n         int makes it clear that these functions are predicates.\n     \n         Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n3:  7eaf8042061 = 3:  66968714739 strbuf: convert predicates to return bool\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"521994","messageId":"352f80c49b74053d611e7d64991fed1c16d857a4.1752587571.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752587571.git.phillip.wood@dunelm.org.uk","subject":"[PATCH v2 1/3] CodingGuildlines: allow the use of bool","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-15T13:52:50Z","receivedAt":"2025-07-15T13:53:14Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nWe have had a test balloon for C99's bool type since 8277dbe987\n(git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n2023-12-16). As we've had it over 18 months without any complaints\nlet's declare it a success.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n Documentation/CodingGuidelines | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines\nindex 6350949f2ef..528b42d1dd1 100644\n--- a/Documentation/CodingGuidelines\n+++ b/Documentation/CodingGuidelines\n@@ -298,6 +298,9 @@ For C programs:\n    . since late 2021 with 44ba10d6, we have had variables declared in\n      the for loop \"for (int i = 0; i < 10; i++)\".\n \n+   . since late 2023 with 8277dbe987 we have been using the bool type\n+     from <stdbool.h>.\n+\n    New C99 features that we cannot use yet:\n \n    . %z and %zu as a printf() argument for a size_t (the %z being for\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"521995","messageId":"0b2402e11cc8a6b096139f796ea280d0ba56b418.1752587571.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752587571.git.phillip.wood@dunelm.org.uk","subject":"[PATCH v2 2/3] git-compat-util: convert string predicates to return bool","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-15T13:52:51Z","receivedAt":"2025-07-15T13:53:15Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nSince 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\nto bool, 2023-12-16) a number of our string predicates have been\nreturning bool instead of int. Now that we've declared that experiment\na success, let's convert the return type of the case-independent\nskip_iprefix() and skip_iprefix_mem() functions to match the return\ntype of their case-dependent equivalents. Returning bool instead of\nint makes it clear that these functions are predicates.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n git-compat-util.h | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 5bd69ec0403..9408f463e31 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -897,35 +897,35 @@ static inline size_t xsize_t(off_t len)\n  * is done via tolower(), so it is strictly ASCII (no multi-byte characters or\n  * locale-specific conversions).\n  */\n-static inline int skip_iprefix(const char *str, const char *prefix,\n+static inline bool skip_iprefix(const char *str, const char *prefix,\n \t\t\t       const char **out)\n {\n \tdo {\n \t\tif (!*prefix) {\n \t\t\t*out = str;\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\t}\n \t} while (tolower(*str++) == tolower(*prefix++));\n-\treturn 0;\n+\treturn false;\n }\n \n /*\n  * Like skip_prefix_mem, but compare case-insensitively. Note that the\n  * comparison is done via tolower(), so it is strictly ASCII (no multi-byte\n  * characters or locale-specific conversions).\n  */\n-static inline int skip_iprefix_mem(const char *buf, size_t len,\n+static inline bool skip_iprefix_mem(const char *buf, size_t len,\n \t\t\t\t   const char *prefix,\n \t\t\t\t   const char **out, size_t *outlen)\n {\n \tdo {\n \t\tif (!*prefix) {\n \t\t\t*out = buf;\n \t\t\t*outlen = len;\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\t}\n \t} while (len-- > 0 && tolower(*buf++) == tolower(*prefix++));\n-\treturn 0;\n+\treturn false;\n }\n \n static inline int strtoul_ui(char const *s, int base, unsigned int *result)\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"521996","messageId":"66968714739dcca36c63cb951b13bd2aee6b9958.1752587571.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752587571.git.phillip.wood@dunelm.org.uk","subject":"[PATCH v2 3/3] strbuf: convert predicates to return bool","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-15T13:52:52Z","receivedAt":"2025-07-15T13:53:16Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nNow that the string predicates defined in git-compat-util.h all\nreturn bool let's convert the return type of the string predicates\nin strbuf.{c,h} to match them.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n strbuf.c | 28 ++++++++++++++--------------\n strbuf.h | 12 ++++++------\n 2 files changed, 20 insertions(+), 20 deletions(-)\n\ndiff --git a/strbuf.c b/strbuf.c\nindex f30fdc69843..6c3851a7f84 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -8,55 +8,55 @@\n #include \"utf8.h\"\n #include \"date.h\"\n \n-int starts_with(const char *str, const char *prefix)\n+bool starts_with(const char *str, const char *prefix)\n {\n \tfor (; ; str++, prefix++)\n \t\tif (!*prefix)\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\telse if (*str != *prefix)\n-\t\t\treturn 0;\n+\t\t\treturn false;\n }\n \n-int istarts_with(const char *str, const char *prefix)\n+bool istarts_with(const char *str, const char *prefix)\n {\n \tfor (; ; str++, prefix++)\n \t\tif (!*prefix)\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\telse if (tolower(*str) != tolower(*prefix))\n-\t\t\treturn 0;\n+\t\t\treturn false;\n }\n \n-int starts_with_mem(const char *str, size_t len, const char *prefix)\n+bool starts_with_mem(const char *str, size_t len, const char *prefix)\n {\n \tconst char *end = str + len;\n \tfor (; ; str++, prefix++) {\n \t\tif (!*prefix)\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\telse if (str == end || *str != *prefix)\n-\t\t\treturn 0;\n+\t\t\treturn false;\n \t}\n }\n \n-int skip_to_optional_arg_default(const char *str, const char *prefix,\n+bool skip_to_optional_arg_default(const char *str, const char *prefix,\n \t\t\t\t const char **arg, const char *def)\n {\n \tconst char *p;\n \n \tif (!skip_prefix(str, prefix, &p))\n-\t\treturn 0;\n+\t\treturn false;\n \n \tif (!*p) {\n \t\tif (arg)\n \t\t\t*arg = def;\n-\t\treturn 1;\n+\t\treturn true;\n \t}\n \n \tif (*p != '=')\n-\t\treturn 0;\n+\t\treturn false;\n \n \tif (arg)\n \t\t*arg = p + 1;\n-\treturn 1;\n+\treturn true;\n }\n \n /*\ndiff --git a/strbuf.h b/strbuf.h\nindex 6362777c0a0..a580ac6084b 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -660,9 +660,9 @@ char *xstrvfmt(const char *fmt, va_list ap);\n __attribute__((format (printf, 1, 2)))\n char *xstrfmt(const char *fmt, ...);\n \n-int starts_with(const char *str, const char *prefix);\n-int istarts_with(const char *str, const char *prefix);\n-int starts_with_mem(const char *str, size_t len, const char *prefix);\n+bool starts_with(const char *str, const char *prefix);\n+bool istarts_with(const char *str, const char *prefix);\n+bool starts_with_mem(const char *str, size_t len, const char *prefix);\n \n /*\n  * If the string \"str\" is the same as the string in \"prefix\", then the \"arg\"\n@@ -678,16 +678,16 @@ int starts_with_mem(const char *str, size_t len, const char *prefix);\n  * can be used instead of !strcmp(arg, \"--key\") and then\n  * skip_prefix(arg, \"--key=\", &arg) to parse such an option.\n  */\n-int skip_to_optional_arg_default(const char *str, const char *prefix,\n+bool skip_to_optional_arg_default(const char *str, const char *prefix,\n \t\t\t\t const char **arg, const char *def);\n \n-static inline int skip_to_optional_arg(const char *str, const char *prefix,\n+static inline bool skip_to_optional_arg(const char *str, const char *prefix,\n \t\t\t\t       const char **arg)\n {\n \treturn skip_to_optional_arg_default(str, prefix, arg, \"\");\n }\n \n-static inline int ends_with(const char *str, const char *suffix)\n+static inline bool ends_with(const char *str, const char *suffix)\n {\n \tsize_t len;\n \treturn strip_suffix(str, suffix, &len);\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"522015","messageId":"CABPp-BHoTxT1UQtgy2bH=mc1re_LPngKX-50GPh_wbtMMZZpyQ@mail.gmail.com","threadId":"63791","inReplyTo":"cover.1752587571.git.phillip.wood@dunelm.org.uk","subject":"Re: [PATCH v2 0/3] C99: declare bool experiment a success","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2025-07-15T17:19:27Z","receivedAt":"2025-07-15T17:19:39Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Jul 15, 2025 at 6:53 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n>\n> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>\n> We've had a test balloon for C99's bool type since 8277dbe987\n> (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n> 2023-12-16). As it has been over 18 months since this was added and\n> there have been no complaints let's declare it a success and convert\n> the return type our other string predicates to match.\n>\n> Thank you to everyone who commented on V1, the only change here is\n> to fix the typos in the commit message for patch 2.\n>\n> Base-Commit: a30f80fde927d70950b3b4d1820813480968fb0d\n> Published-As: https://github.com/phillipwood/git/releases/tag/pw%2Fuse-c99-bool%2Fv2\n> View-Changes-At: https://github.com/phillipwood/git/compare/a30f80fde...669687147\n> Fetch-It-Via: git fetch https://github.com/phillipwood/git pw/use-c99-bool/v2\n>\n>\n> Phillip Wood (3):\n>   CodingGuildlines: allow the use of bool\n>   git-compat-util: convert string predicates to return bool\n>   strbuf: convert predicates to return bool\n>\n>  Documentation/CodingGuidelines |  3 +++\n>  git-compat-util.h              | 12 ++++++------\n>  strbuf.c                       | 28 ++++++++++++++--------------\n>  strbuf.h                       | 12 ++++++------\n>  4 files changed, 29 insertions(+), 26 deletions(-)\n>\n> Range-diff against v1:\n> 1:  352f80c49b7 = 1:  352f80c49b7 CodingGuildlines: allow the use of bool\n> 2:  a0f9182aa20 ! 2:  0b2402e11cc git-compat-util: convert string predicates to return bool\n>     @@ Commit message\n>          git-compat-util: convert string predicates to return bool\n>\n>          Since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\n>     -    to bool, 2023-12-16) a number of our sting predicates have been\n>     -    returning bool instead of int. Now we've declared that experiment\n>     -    a success lets convert the return type the case independent\n>     +    to bool, 2023-12-16) a number of our string predicates have been\n>     +    returning bool instead of int. Now that we've declared that experiment\n>     +    a success, let's convert the return type of the case-independent\n>          skip_iprefix() and skip_iprefix_mem() functions to match the return\n>     -    type of their case dependent equivalents. Returning bool instead of\n>     +    type of their case-dependent equivalents. Returning bool instead of\n>          int makes it clear that these functions are predicates.\n>\n>          Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n> 3:  7eaf8042061 = 3:  66968714739 strbuf: convert predicates to return bool\n> --\n> 2.49.0.897.gfad3eb7d210\n\nThis version looks good to me, thanks!\n"},{"id":"522018","messageId":"000001dbf5b5$8b316f00$a1944d00$@nexbridge.com","threadId":"63791","inReplyTo":"CABPp-BHoTxT1UQtgy2bH=mc1re_LPngKX-50GPh_wbtMMZZpyQ@mail.gmail.com","subject":"RE: [PATCH v2 0/3] C99: declare bool experiment a success","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2025-07-15T18:23:14Z","receivedAt":"2025-07-15T18:25:00Z","isPatch":true,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On July 15, 2025 1:19 PM Elijah Newren wrote:\n>On Tue, Jul 15, 2025 at 6:53 AM Phillip Wood <phillip.wood123@gmail.com>\n>wrote:\n>>\n>> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>>\n>> We've had a test balloon for C99's bool type since 8277dbe987\n>> (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n>> 2023-12-16). As it has been over 18 months since this was added and\n>> there have been no complaints let's declare it a success and convert\n>> the return type our other string predicates to match.\n>>\n>> Thank you to everyone who commented on V1, the only change here is to\n>> fix the typos in the commit message for patch 2.\n>>\n>> Base-Commit: a30f80fde927d70950b3b4d1820813480968fb0d\n>> Published-As:\n>> https://github.com/phillipwood/git/releases/tag/pw%2Fuse-c99-bool%2Fv2\n>> View-Changes-At:\n>> https://github.com/phillipwood/git/compare/a30f80fde...669687147\n>> Fetch-It-Via: git fetch https://github.com/phillipwood/git\n>> pw/use-c99-bool/v2\n>>\n>>\n>> Phillip Wood (3):\n>>   CodingGuildlines: allow the use of bool\n>>   git-compat-util: convert string predicates to return bool\n>>   strbuf: convert predicates to return bool\n>>\n>>  Documentation/CodingGuidelines |  3 +++\n>>  git-compat-util.h              | 12 ++++++------\n>>  strbuf.c                       | 28 ++++++++++++++--------------\n>>  strbuf.h                       | 12 ++++++------\n>>  4 files changed, 29 insertions(+), 26 deletions(-)\n>>\n>> Range-diff against v1:\n>> 1:  352f80c49b7 = 1:  352f80c49b7 CodingGuildlines: allow the use of\n>> bool\n>> 2:  a0f9182aa20 ! 2:  0b2402e11cc git-compat-util: convert string predicates to\n>return bool\n>>     @@ Commit message\n>>          git-compat-util: convert string predicates to return bool\n>>\n>>          Since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\n>>     -    to bool, 2023-12-16) a number of our sting predicates have been\n>>     -    returning bool instead of int. Now we've declared that experiment\n>>     -    a success lets convert the return type the case independent\n>>     +    to bool, 2023-12-16) a number of our string predicates have been\n>>     +    returning bool instead of int. Now that we've declared that experiment\n>>     +    a success, let's convert the return type of the case-independent\n>>          skip_iprefix() and skip_iprefix_mem() functions to match the return\n>>     -    type of their case dependent equivalents. Returning bool instead of\n>>     +    type of their case-dependent equivalents. Returning bool instead of\n>>          int makes it clear that these functions are predicates.\n>>\n>>          Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n>> 3:  7eaf8042061 = 3:  66968714739 strbuf: convert predicates to return\n>> bool\n\nbool is not standard in all c99 implementations. I have to #include <stdbool.h> in order to\nuse this type. Please make sure there is a mechanism for that.\n\n"},{"id":"522026","messageId":"xmqqtt3dgua4.fsf@gitster.g","threadId":"63791","inReplyTo":"CABPp-BHoTxT1UQtgy2bH=mc1re_LPngKX-50GPh_wbtMMZZpyQ@mail.gmail.com","subject":"Re: [PATCH v2 0/3] C99: declare bool experiment a success","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-15T18:53:39Z","receivedAt":"2025-07-15T18:53:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n>>          Since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\n>>     -    to bool, 2023-12-16) a number of our sting predicates have been\n>>     -    returning bool instead of int. Now we've declared that experiment\n>>     -    a success lets convert the return type the case independent\n>>     +    to bool, 2023-12-16) a number of our string predicates have been\n>>     +    returning bool instead of int. Now that we've declared that experiment\n>>     +    a success, let's convert the return type of the case-independent\n>>          skip_iprefix() and skip_iprefix_mem() functions to match the return\n>>     -    type of their case dependent equivalents. Returning bool instead of\n>>     +    type of their case-dependent equivalents. Returning bool instead of\n>>          int makes it clear that these functions are predicates.\n>>\n>>          Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n>> 3:  7eaf8042061 = 3:  66968714739 strbuf: convert predicates to return bool\n>> --\n>> 2.49.0.897.gfad3eb7d210\n>\n> This version looks good to me, thanks!\n\nThanks, looking good.\n"},{"id":"522039","messageId":"CABPp-BHjU2NFVoM+wkBxDrr3P85yYzmS-O4mBAc_e4_6wfOBMw@mail.gmail.com","threadId":"63791","inReplyTo":"000001dbf5b5$8b316f00$a1944d00$@nexbridge.com","subject":"Re: [PATCH v2 0/3] C99: declare bool experiment a success","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2025-07-15T19:35:08Z","receivedAt":"2025-07-15T19:35:20Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Jul 15, 2025 at 11:23 AM <rsbecker@nexbridge.com> wrote:\n>\n> On July 15, 2025 1:19 PM Elijah Newren wrote:\n> >On Tue, Jul 15, 2025 at 6:53 AM Phillip Wood <phillip.wood123@gmail.com>\n> >wrote:\n> >>\n> >> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n> >>\n> >> We've had a test balloon for C99's bool type since 8277dbe987\n> >> (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n> >> 2023-12-16). As it has been over 18 months since this was added and\n> >> there have been no complaints let's declare it a success and convert\n> >> the return type our other string predicates to match.\n> >>\n[...]\n>\n> bool is not standard in all c99 implementations. I have to #include <stdbool.h> in order to\n> use this type. Please make sure there is a mechanism for that.\n\nFrom the referenced commit in the commit message:\n\n$ git log --oneline -1 -p 8277dbe987 | head -n 13\n8277dbe9872 git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 3e7a59b5ff1..603c97e3b3f 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -225,6 +225,7 @@ struct strbuf;\n #include <stddef.h>\n #include <stdlib.h>\n #include <stdarg.h>\n+#include <stdbool.h>\n #include <string.h>\n #ifdef HAVE_STRINGS_H\n #include <strings.h> /* for strcasecmp() */\n\n\nSo, there's not only a mechanism for that, it has already been done\nfor you 1.5 years ago.  No extra work on your or anyone else's part\nneeded.  :-)\n"},{"id":"522043","messageId":"000501dbf5c9$af9598d0$0ec0ca70$@nexbridge.com","threadId":"63791","inReplyTo":"CABPp-BHjU2NFVoM+wkBxDrr3P85yYzmS-O4mBAc_e4_6wfOBMw@mail.gmail.com","subject":"RE: [PATCH v2 0/3] C99: declare bool experiment a success","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2025-07-15T20:47:25Z","receivedAt":"2025-07-15T20:47:44Z","isPatch":true,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On July 15, 2025 3:35 PM, Elijah Newren wrote:\n>On Tue, Jul 15, 2025 at 11:23 AM <rsbecker@nexbridge.com> wrote:\n>>\n>> On July 15, 2025 1:19 PM Elijah Newren wrote:\n>> >On Tue, Jul 15, 2025 at 6:53 AM Phillip Wood\n>> ><phillip.wood123@gmail.com>\n>> >wrote:\n>> >>\n>> >> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>> >>\n>> >> We've had a test balloon for C99's bool type since 8277dbe987\n>> >> (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n>> >> 2023-12-16). As it has been over 18 months since this was added and\n>> >> there have been no complaints let's declare it a success and\n>> >> convert the return type our other string predicates to match.\n>> >>\n>[...]\n>>\n>> bool is not standard in all c99 implementations. I have to #include\n>> <stdbool.h> in order to use this type. Please make sure there is a mechanism for\n>that.\n>\n>>From the referenced commit in the commit message:\n>\n>$ git log --oneline -1 -p 8277dbe987 | head -n 13\n>8277dbe9872 git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool diff --git\n>a/git-compat-util.h b/git-compat-util.h index 3e7a59b5ff1..603c97e3b3f 100644\n>--- a/git-compat-util.h\n>+++ b/git-compat-util.h\n>@@ -225,6 +225,7 @@ struct strbuf;\n> #include <stddef.h>\n> #include <stdlib.h>\n> #include <stdarg.h>\n>+#include <stdbool.h>\n> #include <string.h>\n> #ifdef HAVE_STRINGS_H\n> #include <strings.h> /* for strcasecmp() */\n>\n>\n>So, there's not only a mechanism for that, it has already been done for you 1.5\n>years ago.  No extra work on your or anyone else's part needed.  :-)\n\nMany thanks.\n\n"},{"id":"522045","messageId":"xmqq5xftgo41.fsf@gitster.g","threadId":"63791","inReplyTo":"000001dbf5b5$8b316f00$a1944d00$@nexbridge.com","subject":"Re: [PATCH v2 0/3] C99: declare bool experiment a success","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-15T21:06:54Z","receivedAt":"2025-07-15T21:06:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"<rsbecker@nexbridge.com> writes:\n\n> bool is not standard in all c99 implementations. I have to #include <stdbool.h> in order to\n> use this type. Please make sure there is a mechanism for that.\n\nGiven that <git-compat-util.h> unconditionally includes\n<compat/posix.h> and <compat/posix.h> unconditionally includes\n<stdbool.h> even in today's code, that should be OK.\n"},{"id":"522049","messageId":"aHbMlUKNL2CAK_9I@fruit.crustytoothpaste.net","threadId":"63791","inReplyTo":"cover.1752587571.git.phillip.wood@dunelm.org.uk","subject":"Re: [PATCH v2 0/3] C99: declare bool experiment a success","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2025-07-15T21:48:05Z","receivedAt":"2025-07-15T21:48:13Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2025-07-15 at 13:52:49, Phillip Wood wrote:\n> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n> \n> We've had a test balloon for C99's bool type since 8277dbe987\n> (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n> 2023-12-16). As it has been over 18 months since this was added and\n> there have been no complaints let's declare it a success and convert\n> the return type our other string predicates to match.\n> \n> Thank you to everyone who commented on V1, the only change here is\n> to fix the typos in the commit message for patch 2.\n\nThis series looked good to me.  I especially like the fact that we've\nmade it easier for me to figure out whether starts_with and friends are\nbooleans (that is, true if it starts with the value) or our standard\nzero/negative-one (that is, false if it starts with the value).\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"},{"id":"522052","messageId":"xmqqikjtf6nu.fsf@gitster.g","threadId":"63791","inReplyTo":"aHbMlUKNL2CAK_9I@fruit.crustytoothpaste.net","subject":"Re: [PATCH v2 0/3] C99: declare bool experiment a success","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-15T22:09:09Z","receivedAt":"2025-07-15T22:09:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> This series looked good to me.  I especially like the fact that we've\n> made it easier for me to figure out whether starts_with and friends are\n> booleans (that is, true if it starts with the value) or our standard\n> zero/negative-one (that is, false if it starts with the value).\n\nHmph, this is a tangent, I've never thought of it that way.\n\nThe \"0 is success and negative is failure\" is exactly about success\nand failure.  We expect such a call to succeed most of the time and\nfailure is a note-worthy event.\n\nFunctions like starts_with() and friends, those that Lispers might\nname with q suffix, are quite different.  A predicate is asking \"is\nit, or isn't it?\" question and returning \"false\" from it does not\nimply a failure in any way.\n\nI wouldn't dream of making them return -1 for \"failure\", because\nstarts_with(buf.buf, \"#\") that finds buf.buf does not begin with \"#\"\nis no way failing.\n\nAnyway, we may start rewriting our old-fashioned idiom to normalize\na \"true if non-zero\" integers, i.e.\n\n\treturn !!some_true_if_non_zero_integer_variable;\n\ninto \n\n\treturn (bool)some_true_if_non_zero_integer_variable;\n\nperhaps ;-).\n"},{"id":"522063","messageId":"20250716043827.GA1395459@coredump.intra.peff.net","threadId":"63791","inReplyTo":"352f80c49b74053d611e7d64991fed1c16d857a4.1752587571.git.phillip.wood@dunelm.org.uk","subject":"Re: [PATCH v2 1/3] CodingGuildlines: allow the use of bool","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-07-16T04:38:27Z","receivedAt":"2025-07-16T04:38:29Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jul 15, 2025 at 02:52:50PM +0100, Phillip Wood wrote:\n\n> Subject: Re: [PATCH v2 1/3] CodingGuildlines: allow the use of bool\n\nI was lots of discussion about grammar elsewhere, but nobody seems to\nhave mentioned \"Guildlines\" instead of \"Guidelines\". :)\n\n-Peff\n"},{"id":"522065","messageId":"20250716044658.GA1396022@coredump.intra.peff.net","threadId":"63791","inReplyTo":"20250716043827.GA1395459@coredump.intra.peff.net","subject":"Re: [PATCH v2 1/3] CodingGuildlines: allow the use of bool","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-07-16T04:46:58Z","receivedAt":"2025-07-16T04:47:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jul 16, 2025 at 12:38:27AM -0400, Jeff King wrote:\n\n> On Tue, Jul 15, 2025 at 02:52:50PM +0100, Phillip Wood wrote:\n> \n> > Subject: Re: [PATCH v2 1/3] CodingGuildlines: allow the use of bool\n> \n> I was lots of discussion about grammar elsewhere, but nobody seems to\n> have mentioned \"Guildlines\" instead of \"Guidelines\". :)\n\ns/was/saw/, obviously.\n\nSurely somebody has coined a name for the law that any statement\npointing out a typo or grammatical issue is vastly more likely to\ncontain one itself.\n\n-Peff\n"},{"id":"522068","messageId":"CABPp-BFf1HApgiPwQc_yM2=DdyzN0QTxFZQRt--RBAvJqpCX0A@mail.gmail.com","threadId":"63791","inReplyTo":"20250716044658.GA1396022@coredump.intra.peff.net","subject":"Re: [PATCH v2 1/3] CodingGuildlines: allow the use of bool","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2025-07-16T05:06:17Z","receivedAt":"2025-07-16T05:06:29Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Jul 15, 2025 at 9:46 PM Jeff King <peff@peff.net> wrote:\n>\n> On Wed, Jul 16, 2025 at 12:38:27AM -0400, Jeff King wrote:\n>\n> > On Tue, Jul 15, 2025 at 02:52:50PM +0100, Phillip Wood wrote:\n> >\n> > > Subject: Re: [PATCH v2 1/3] CodingGuildlines: allow the use of bool\n> >\n> > I was lots of discussion about grammar elsewhere, but nobody seems to\n> > have mentioned \"Guildlines\" instead of \"Guidelines\". :)\n>\n> s/was/saw/, obviously.\n\nhehe\n\n> Surely somebody has coined a name for the law that any statement\n> pointing out a typo or grammatical issue is vastly more likely to\n> contain one itself.\n\nhttps://en.wikipedia.org/wiki/Muphry%27s_law\n"},{"id":"522082","messageId":"cover.1752658700.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752499610.git.phillip.wood@dunelm.org.uk","subject":"[PATCH v3 0/3] C99: declare bool experiment a success","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-16T09:38:27Z","receivedAt":"2025-07-16T09:39:22Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nWe've had a test balloon for C99's bool type since 8277dbe987\n(git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n2023-12-16). As it has been over 18 months since this was added and\nthere have been no complaints let's declare it a success and convert\nthe return type our other string predicates to match.\n\nThanks to peff for spotting yet another typo - I've updated the commit\nmessage for patch 1 accordingly.\n\nBase-Commit: a30f80fde927d70950b3b4d1820813480968fb0d\nPublished-As: https://github.com/phillipwood/git/releases/tag/pw%2Fuse-c99-bool%2Fv3\nView-Changes-At: https://github.com/phillipwood/git/compare/a30f80fde...80e5cd3b9\nFetch-It-Via: git fetch https://github.com/phillipwood/git pw/use-c99-bool/v3\n\n\nPhillip Wood (3):\n  CodingGuidelines: allow the use of bool\n  git-compat-util: convert string predicates to return bool\n  strbuf: convert predicates to return bool\n\n Documentation/CodingGuidelines |  3 +++\n git-compat-util.h              | 12 ++++++------\n strbuf.c                       | 28 ++++++++++++++--------------\n strbuf.h                       | 12 ++++++------\n 4 files changed, 29 insertions(+), 26 deletions(-)\n\nRange-diff against v2:\n1:  352f80c49b7 ! 1:  3ff7ae61f45 CodingGuildlines: allow the use of bool\n    @@ Metadata\n     Author: Phillip Wood <phillip.wood@dunelm.org.uk>\n     \n      ## Commit message ##\n    -    CodingGuildlines: allow the use of bool\n    +    CodingGuidelines: allow the use of bool\n     \n         We have had a test balloon for C99's bool type since 8277dbe987\n         (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n2:  0b2402e11cc = 2:  26c3f48ac6c git-compat-util: convert string predicates to return bool\n3:  66968714739 = 3:  80e5cd3b9df strbuf: convert predicates to return bool\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"522083","messageId":"3ff7ae61f45c87de5a5304b45809994bd862d945.1752658700.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752658700.git.phillip.wood@dunelm.org.uk","subject":"[PATCH v3 1/3] CodingGuidelines: allow the use of bool","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-16T09:38:28Z","receivedAt":"2025-07-16T09:39:23Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nWe have had a test balloon for C99's bool type since 8277dbe987\n(git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n2023-12-16). As we've had it over 18 months without any complaints\nlet's declare it a success.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n Documentation/CodingGuidelines | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines\nindex 6350949f2ef..528b42d1dd1 100644\n--- a/Documentation/CodingGuidelines\n+++ b/Documentation/CodingGuidelines\n@@ -298,6 +298,9 @@ For C programs:\n    . since late 2021 with 44ba10d6, we have had variables declared in\n      the for loop \"for (int i = 0; i < 10; i++)\".\n \n+   . since late 2023 with 8277dbe987 we have been using the bool type\n+     from <stdbool.h>.\n+\n    New C99 features that we cannot use yet:\n \n    . %z and %zu as a printf() argument for a size_t (the %z being for\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"522084","messageId":"26c3f48ac6c150b438c7b2f442f55a3d17141345.1752658700.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752658700.git.phillip.wood@dunelm.org.uk","subject":"[PATCH v3 2/3] git-compat-util: convert string predicates to return bool","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-16T09:38:29Z","receivedAt":"2025-07-16T09:39:24Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nSince 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\nto bool, 2023-12-16) a number of our string predicates have been\nreturning bool instead of int. Now that we've declared that experiment\na success, let's convert the return type of the case-independent\nskip_iprefix() and skip_iprefix_mem() functions to match the return\ntype of their case-dependent equivalents. Returning bool instead of\nint makes it clear that these functions are predicates.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n git-compat-util.h | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 5bd69ec0403..9408f463e31 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -897,35 +897,35 @@ static inline size_t xsize_t(off_t len)\n  * is done via tolower(), so it is strictly ASCII (no multi-byte characters or\n  * locale-specific conversions).\n  */\n-static inline int skip_iprefix(const char *str, const char *prefix,\n+static inline bool skip_iprefix(const char *str, const char *prefix,\n \t\t\t       const char **out)\n {\n \tdo {\n \t\tif (!*prefix) {\n \t\t\t*out = str;\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\t}\n \t} while (tolower(*str++) == tolower(*prefix++));\n-\treturn 0;\n+\treturn false;\n }\n \n /*\n  * Like skip_prefix_mem, but compare case-insensitively. Note that the\n  * comparison is done via tolower(), so it is strictly ASCII (no multi-byte\n  * characters or locale-specific conversions).\n  */\n-static inline int skip_iprefix_mem(const char *buf, size_t len,\n+static inline bool skip_iprefix_mem(const char *buf, size_t len,\n \t\t\t\t   const char *prefix,\n \t\t\t\t   const char **out, size_t *outlen)\n {\n \tdo {\n \t\tif (!*prefix) {\n \t\t\t*out = buf;\n \t\t\t*outlen = len;\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\t}\n \t} while (len-- > 0 && tolower(*buf++) == tolower(*prefix++));\n-\treturn 0;\n+\treturn false;\n }\n \n static inline int strtoul_ui(char const *s, int base, unsigned int *result)\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"522085","messageId":"80e5cd3b9df80cbda58630cae20ff7ca44793d8f.1752658700.git.phillip.wood@dunelm.org.uk","threadId":"63791","inReplyTo":"cover.1752658700.git.phillip.wood@dunelm.org.uk","subject":"[PATCH v3 3/3] strbuf: convert predicates to return bool","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-16T09:38:30Z","receivedAt":"2025-07-16T09:39:25Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nNow that the string predicates defined in git-compat-util.h all\nreturn bool let's convert the return type of the string predicates\nin strbuf.{c,h} to match them.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n strbuf.c | 28 ++++++++++++++--------------\n strbuf.h | 12 ++++++------\n 2 files changed, 20 insertions(+), 20 deletions(-)\n\ndiff --git a/strbuf.c b/strbuf.c\nindex f30fdc69843..6c3851a7f84 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -8,55 +8,55 @@\n #include \"utf8.h\"\n #include \"date.h\"\n \n-int starts_with(const char *str, const char *prefix)\n+bool starts_with(const char *str, const char *prefix)\n {\n \tfor (; ; str++, prefix++)\n \t\tif (!*prefix)\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\telse if (*str != *prefix)\n-\t\t\treturn 0;\n+\t\t\treturn false;\n }\n \n-int istarts_with(const char *str, const char *prefix)\n+bool istarts_with(const char *str, const char *prefix)\n {\n \tfor (; ; str++, prefix++)\n \t\tif (!*prefix)\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\telse if (tolower(*str) != tolower(*prefix))\n-\t\t\treturn 0;\n+\t\t\treturn false;\n }\n \n-int starts_with_mem(const char *str, size_t len, const char *prefix)\n+bool starts_with_mem(const char *str, size_t len, const char *prefix)\n {\n \tconst char *end = str + len;\n \tfor (; ; str++, prefix++) {\n \t\tif (!*prefix)\n-\t\t\treturn 1;\n+\t\t\treturn true;\n \t\telse if (str == end || *str != *prefix)\n-\t\t\treturn 0;\n+\t\t\treturn false;\n \t}\n }\n \n-int skip_to_optional_arg_default(const char *str, const char *prefix,\n+bool skip_to_optional_arg_default(const char *str, const char *prefix,\n \t\t\t\t const char **arg, const char *def)\n {\n \tconst char *p;\n \n \tif (!skip_prefix(str, prefix, &p))\n-\t\treturn 0;\n+\t\treturn false;\n \n \tif (!*p) {\n \t\tif (arg)\n \t\t\t*arg = def;\n-\t\treturn 1;\n+\t\treturn true;\n \t}\n \n \tif (*p != '=')\n-\t\treturn 0;\n+\t\treturn false;\n \n \tif (arg)\n \t\t*arg = p + 1;\n-\treturn 1;\n+\treturn true;\n }\n \n /*\ndiff --git a/strbuf.h b/strbuf.h\nindex 6362777c0a0..a580ac6084b 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -660,9 +660,9 @@ char *xstrvfmt(const char *fmt, va_list ap);\n __attribute__((format (printf, 1, 2)))\n char *xstrfmt(const char *fmt, ...);\n \n-int starts_with(const char *str, const char *prefix);\n-int istarts_with(const char *str, const char *prefix);\n-int starts_with_mem(const char *str, size_t len, const char *prefix);\n+bool starts_with(const char *str, const char *prefix);\n+bool istarts_with(const char *str, const char *prefix);\n+bool starts_with_mem(const char *str, size_t len, const char *prefix);\n \n /*\n  * If the string \"str\" is the same as the string in \"prefix\", then the \"arg\"\n@@ -678,16 +678,16 @@ int starts_with_mem(const char *str, size_t len, const char *prefix);\n  * can be used instead of !strcmp(arg, \"--key\") and then\n  * skip_prefix(arg, \"--key=\", &arg) to parse such an option.\n  */\n-int skip_to_optional_arg_default(const char *str, const char *prefix,\n+bool skip_to_optional_arg_default(const char *str, const char *prefix,\n \t\t\t\t const char **arg, const char *def);\n \n-static inline int skip_to_optional_arg(const char *str, const char *prefix,\n+static inline bool skip_to_optional_arg(const char *str, const char *prefix,\n \t\t\t\t       const char **arg)\n {\n \treturn skip_to_optional_arg_default(str, prefix, arg, \"\");\n }\n \n-static inline int ends_with(const char *str, const char *suffix)\n+static inline bool ends_with(const char *str, const char *suffix)\n {\n \tsize_t len;\n \treturn strip_suffix(str, suffix, &len);\n-- \n2.49.0.897.gfad3eb7d210\n\n"},{"id":"522089","messageId":"CAOLa=ZRNjt720fGVnLNy60qGHUwHX1qQoAq=Z7ZLcde_hxTsvw@mail.gmail.com","threadId":"63791","inReplyTo":"26c3f48ac6c150b438c7b2f442f55a3d17141345.1752658700.git.phillip.wood@dunelm.org.uk","subject":"Re: [PATCH v3 2/3] git-compat-util: convert string predicates to return bool","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-07-16T10:26:53Z","receivedAt":"2025-07-16T10:26:55Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>\n> Since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem}\n> to bool, 2023-12-16) a number of our string predicates have been\n> returning bool instead of int. Now that we've declared that experiment\n> a success, let's convert the return type of the case-independent\n> skip_iprefix() and skip_iprefix_mem() functions to match the return\n> type of their case-dependent equivalents. Returning bool instead of\n> int makes it clear that these functions are predicates.\n>\n> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n> ---\n>  git-compat-util.h | 12 ++++++------\n>  1 file changed, 6 insertions(+), 6 deletions(-)\n>\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index 5bd69ec0403..9408f463e31 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -897,35 +897,35 @@ static inline size_t xsize_t(off_t len)\n>   * is done via tolower(), so it is strictly ASCII (no multi-byte characters or\n>   * locale-specific conversions).\n>   */\n> -static inline int skip_iprefix(const char *str, const char *prefix,\n> +static inline bool skip_iprefix(const char *str, const char *prefix,\n>  \t\t\t       const char **out)\n>  {\n>  \tdo {\n>  \t\tif (!*prefix) {\n>  \t\t\t*out = str;\n> -\t\t\treturn 1;\n> +\t\t\treturn true;\n>  \t\t}\n>  \t} while (tolower(*str++) == tolower(*prefix++));\n> -\treturn 0;\n> +\treturn false;\n>  }\n>\n>  /*\n>   * Like skip_prefix_mem, but compare case-insensitively. Note that the\n>   * comparison is done via tolower(), so it is strictly ASCII (no multi-byte\n>   * characters or locale-specific conversions).\n>   */\n> -static inline int skip_iprefix_mem(const char *buf, size_t len,\n> +static inline bool skip_iprefix_mem(const char *buf, size_t len,\n>  \t\t\t\t   const char *prefix,\n>  \t\t\t\t   const char **out, size_t *outlen)\n>\n\nNit: clang-format complains that we should also format the arguments now\nthat the first line's length changes\n\n$ ./ci/run-style-check.sh @~1\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 9408f463e3..e01abf6eb6 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -898,7 +898,7 @@ static inline size_t xsize_t(off_t len)\n  * locale-specific conversions).\n  */\n static inline bool skip_iprefix(const char *str, const char *prefix,\n-\t\t\t       const char **out)\n+\t\t\t\tconst char **out)\n {\n \tdo {\n \t\tif (!*prefix) {\n@@ -915,8 +915,8 @@ static inline bool skip_iprefix(const char *str,\nconst char *prefix,\n  * characters or locale-specific conversions).\n  */\n static inline bool skip_iprefix_mem(const char *buf, size_t len,\n-\t\t\t\t   const char *prefix,\n-\t\t\t\t   const char **out, size_t *outlen)\n+\t\t\t\t    const char *prefix,\n+\t\t\t\t    const char **out, size_t *outlen)\n {\n \tdo {\n \t\tif (!*prefix) {\n\n[snip]\n"},{"id":"522090","messageId":"CAOLa=ZSXE8n883i8RxD2ovokNPYsxainzBdp4v7qeTuCfNo0mw@mail.gmail.com","threadId":"63791","inReplyTo":"80e5cd3b9df80cbda58630cae20ff7ca44793d8f.1752658700.git.phillip.wood@dunelm.org.uk","subject":"Re: [PATCH v3 3/3] strbuf: convert predicates to return bool","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-07-16T10:28:14Z","receivedAt":"2025-07-16T10:28:16Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>\n> Now that the string predicates defined in git-compat-util.h all\n> return bool let's convert the return type of the string predicates\n> in strbuf.{c,h} to match them.\n>\n> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n> ---\n>  strbuf.c | 28 ++++++++++++++--------------\n>  strbuf.h | 12 ++++++------\n>  2 files changed, 20 insertions(+), 20 deletions(-)\n>\n\nNit: same here as the previous patch\n\n$ ./ci/run-style-check.sh @~1\ndiff --git a/strbuf.c b/strbuf.c\nindex 6c3851a7f8..d9e040c13b 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -38,7 +38,7 @@ bool starts_with_mem(const char *str, size_t len,\nconst char *prefix)\n }\n\n bool skip_to_optional_arg_default(const char *str, const char *prefix,\n-\t\t\t\t const char **arg, const char *def)\n+\t\t\t\t  const char **arg, const char *def)\n {\n \tconst char *p;\n\ndiff --git a/strbuf.h b/strbuf.h\nindex a580ac6084..d2ff9839a9 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -679,10 +679,10 @@ bool starts_with_mem(const char *str, size_t\nlen, const char *prefix);\n  * skip_prefix(arg, \"--key=\", &arg) to parse such an option.\n  */\n bool skip_to_optional_arg_default(const char *str, const char *prefix,\n-\t\t\t\t const char **arg, const char *def);\n+\t\t\t\t  const char **arg, const char *def);\n\n static inline bool skip_to_optional_arg(const char *str, const char *prefix,\n-\t\t\t\t       const char **arg)\n+\t\t\t\t\tconst char **arg)\n {\n \treturn skip_to_optional_arg_default(str, prefix, arg, \"\");\n }\n\n[snip]\n"},{"id":"522091","messageId":"CAOLa=ZSk5O0sQRN5Yf+i6Jh2Dk_pafQhLYNY5eBp_S5y-HoC3w@mail.gmail.com","threadId":"63791","inReplyTo":"cover.1752658700.git.phillip.wood@dunelm.org.uk","subject":"Re: [PATCH v3 0/3] C99: declare bool experiment a success","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-07-16T10:29:55Z","receivedAt":"2025-07-16T10:29:57Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>\n> We've had a test balloon for C99's bool type since 8277dbe987\n> (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n> 2023-12-16). As it has been over 18 months since this was added and\n> there have been no complaints let's declare it a success and convert\n> the return type our other string predicates to match.\n>\n\nNeat, I didn't even know we were running such an experiment. Thanks for\ngetting around to it, I think the patches look great, added some\ncomplaints from 'clang-format', feel free to ignore.\n\nThanks,\nKarthik\n\n[snip]\n"},{"id":"522208","messageId":"3e799a41-fa68-4d22-8e8e-930fcab807f8@gmail.com","threadId":"63791","inReplyTo":"CAOLa=ZSk5O0sQRN5Yf+i6Jh2Dk_pafQhLYNY5eBp_S5y-HoC3w@mail.gmail.com","subject":"Re: [PATCH v3 0/3] C99: declare bool experiment a success","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-17T15:21:12Z","receivedAt":"2025-07-17T15:21:17Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Karthik\n\nOn 16/07/2025 11:29, Karthik Nayak wrote:\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n> \n>> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>>\n>> We've had a test balloon for C99's bool type since 8277dbe987\n>> (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n>> 2023-12-16). As it has been over 18 months since this was added and\n>> there have been no complaints let's declare it a success and convert\n>> the return type our other string predicates to match.\n>>\n> \n> Neat, I didn't even know we were running such an experiment. Thanks for\n> getting around to it, I think the patches look great, added some\n> complaints from 'clang-format', feel free to ignore.\n\nThanks for taking a look. I would have fixed the formatting but this is \nin next already so I'll leave it as it is if that's ok with you.\n\nThanks\n\nPhillip\n\n"},{"id":"522401","messageId":"CAOLa=ZQZ_UX1YquMiJgSGN0u9+LiUAK9HijaLY5DUN1y_j6+tg@mail.gmail.com","threadId":"63791","inReplyTo":"3e799a41-fa68-4d22-8e8e-930fcab807f8@gmail.com","subject":"Re: [PATCH v3 0/3] C99: declare bool experiment a success","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-07-22T08:09:31Z","receivedAt":"2025-07-22T08:09:32Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> Hi Karthik\n>\n> On 16/07/2025 11:29, Karthik Nayak wrote:\n>> Phillip Wood <phillip.wood123@gmail.com> writes:\n>>\n>>> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>>>\n>>> We've had a test balloon for C99's bool type since 8277dbe987\n>>> (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool,\n>>> 2023-12-16). As it has been over 18 months since this was added and\n>>> there have been no complaints let's declare it a success and convert\n>>> the return type our other string predicates to match.\n>>>\n>>\n>> Neat, I didn't even know we were running such an experiment. Thanks for\n>> getting around to it, I think the patches look great, added some\n>> complaints from 'clang-format', feel free to ignore.\n>\n> Thanks for taking a look. I would have fixed the formatting but this is\n> in next already so I'll leave it as it is if that's ok with you.\n>\n\nOf course :) These are small nits. I'm mostly interested in getting\nclang-format to work without any/many false positives, so I'm trying to\ntest it with different patches that I read and report back!\n\n> Thanks\n>\n> Phillip\n"}]}