]> git.ipfire.org Git - thirdparty/git.git/commitdiff
test-parse-options.c: fix style of comparison with zero
authorSZEDER Gábor <szeder.dev@gmail.com>
Mon, 5 Sep 2022 18:50:05 +0000 (20:50 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Sep 2022 19:06:12 +0000 (12:06 -0700)
The preferred style is '!argc' instead of 'argc == 0'.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-parse-options.c

index 9fe8ce66cb0ec19ce2d4b9b7a2a75bf6184a92d8..506835521a463aebd1a06259cf96e05d71e3833b 100644 (file)
@@ -255,7 +255,7 @@ int cmd__parse_options_flags(int argc, const char **argv)
        argc = parse_options(argc, argv, NULL, test_flag_options, usage,
                             PARSE_OPT_STOP_AT_NON_OPTION);
 
-       if (argc == 0 || strcmp(argv[0], "cmd")) {
+       if (!argc || strcmp(argv[0], "cmd")) {
                error("'cmd' is mandatory");
                usage_with_options(usage, test_flag_options);
        }
@@ -313,7 +313,7 @@ int cmd__parse_subcommand(int argc, const char **argv)
        argc = parse_options(argc, argv, NULL, test_flag_options, usage,
                             PARSE_OPT_STOP_AT_NON_OPTION);
 
-       if (argc == 0 || strcmp(argv[0], "cmd")) {
+       if (!argc || strcmp(argv[0], "cmd")) {
                error("'cmd' is mandatory");
                usage_with_options(usage, test_flag_options);
        }