From: Plato Kiorpelidis Date: Mon, 09 May 2022 17:51:48 GMT Subject: [PATCH v2 04/15] test-dir-iterator: consistently return EXIT_FAILURE or EXIT_SUCCESS Message-ID: <20220509175159.2948802-5-kioplato@gmail.com> In-Reply-To: <20220509175159.2948802-1-kioplato@gmail.com> Throughout test-dir-iterator.c we were returning/exiting with either integers or EXIT_FAILURE. Improve readability and reduce mental load by being consistent with what test-dir-iterator returns through the test-tool. Returning mixed constants and integers could indicate that it matters for some reason e.g. architecture of test-tool and cmd__* functions. EXIT_SUCCESS and EXIT_FAILURE are specified by the C standard. That makes the code more portable and standardized. Signed-off-by: Plato Kiorpelidis --- t/helper/test-dir-iterator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/helper/test-dir-iterator.c b/t/helper/test-dir-iterator.c index 659b6bfa81..81e931673e 100644 --- a/t/helper/test-dir-iterator.c +++ b/t/helper/test-dir-iterator.c @@ -39,7 +39,7 @@ int cmd__dir_iterator(int argc, const char **argv) if (!diter) { printf("dir_iterator_begin failure: %s\n", error_name(errno)); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } while ((iter_status = dir_iterator_advance(diter)) == ITER_OK) { @@ -58,8 +58,8 @@ int cmd__dir_iterator(int argc, const char **argv) if (iter_status != ITER_DONE) { printf("dir_iterator_advance failure\n"); - return 1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } -- 2.36.1