]> git.ipfire.org Git - thirdparty/git.git/commitdiff
parseopt: use boolean type for a simple flag
authorD. Ben Knoble <ben.knoble+github@gmail.com>
Sun, 2 Nov 2025 16:17:46 +0000 (11:17 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 4 Nov 2025 17:25:51 +0000 (09:25 -0800)
Suggested-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
parse-options.c

index 5b7dc29b2ce645daffeed8bcca79f6a7afaa7998..b105e4b6cf683ed5c6f4f313d4a18f074008e130 100644 (file)
@@ -208,7 +208,7 @@ static enum parse_opt_result do_get_value(struct parse_opt_ctx_t *p,
        case OPTION_FILENAME:
        {
                const char *value;
-               int is_optional;
+               bool is_optional;
 
                if (unset)
                        value = NULL;
@@ -224,7 +224,7 @@ static enum parse_opt_result do_get_value(struct parse_opt_ctx_t *p,
 
                is_optional = skip_prefix(value, ":(optional)", &value);
                if (!value)
-                       is_optional = 0;
+                       is_optional = false;
                value = fix_filename(p->prefix, value);
                if (is_optional && is_missing_file(value)) {
                        free((char *)value);