[PATCH 08/10] test-advise: check argument count with argc instead of argv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We complain if "test-tool advise" is not given an argument, but we
quietly ignore any additional arguments it receives. Let's instead check
that we got the expected number. As a bonus, this silences
-Wunused-parameter, which notes that we don't ever look at argc.

While we're here, we can also fix the indentation in the conditional.

Signed-off-by: Jeff King <peff@xxxxxxxx>
---
 t/helper/test-advise.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/helper/test-advise.c b/t/helper/test-advise.c
index 38cdc2884e..a7043df1d3 100644
--- a/t/helper/test-advise.c
+++ b/t/helper/test-advise.c
@@ -5,8 +5,8 @@
 
 int cmd__advise_if_enabled(int argc, const char **argv)
 {
-	if (!argv[1])
-	die("usage: %s <advice>", argv[0]);
+	if (argc != 2)
+		die("usage: %s <advice>", argv[0]);
 
 	setup_git_directory();
 	git_config(git_default_config, NULL);
-- 
2.28.0.1173.gad90222cf0




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux