Skip to content

Commit

Permalink
do not check truth value of flex arrays
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Jan 28, 2015
1 parent 249b200 commit 94ee8e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion remote-curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 94ee8e2

Please sign in to comment.