]> git.ipfire.org Git - thirdparty/git.git/commitdiff
do not check truth value of flex arrays
authorJeff King <peff@peff.net>
Wed, 28 Jan 2015 17:58:50 +0000 (12:58 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Jan 2015 20:46:07 +0000 (12:46 -0800)
There is no point in checking "!ref->name" when ref is a
"struct ref". The name field is a flex-array, and there
always has a non-zero address. This is almost certainly not
hurting anything, but it does cause clang-3.6 to complain.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote-curl.c

index 0eb6fc48fbb8f9c599386381539bd2fa4d23e40e..38cab05ec52585c886e09f58acb2511c9209cbcb 100644 (file)
@@ -514,7 +514,7 @@ static int fetch_git(struct discovery *heads,
        argv[argc++] = url;
        for (i = 0; i < nr_heads; i++) {
                struct ref *ref = to_fetch[i];
-               if (!ref->name || !*ref->name)
+               if (!*ref->name)
                        die("cannot fetch by sha1 over smart http");
                argv[argc++] = ref->name;
        }