Re: [PATCH v2 09/12] fetch: don't redundantly NULL something calloc() gave us

2018-01-21 Thread Ævar Arnfjörð Bjarmason

On Sun, Jan 21 2018, Ævar Arnfjörð Bjarmason jotted:

> 2007-09-10), where wasn't any reason to do this back then either, it's

s/where wasn't/where there wasn't/

> The initial motivation for this change was to make a subsequent change
> which'll also modify the refs variable smaller, since it won't have to
> copy this redundant "NULL the last + 1 item" pattern.

Which, FWIW is not happening later in this series anymore, so this is
just a "cleanup while I'm at it" patch at this point. Will note that in
a v3 commit message pending more comments.


[PATCH v2 09/12] fetch: don't redundantly NULL something calloc() gave us

2018-01-20 Thread Ævar Arnfjörð Bjarmason
Stop redundantly NULL-ing the last element of the refs structure,
which was retrieved via calloc(), and is thus guaranteed to be
pre-NULL'd.

This code dates back to b888d61c83 ("Make fetch a builtin",
2007-09-10), where wasn't any reason to do this back then either, it's
just something left over from when git-fetch was initially introduced.

The initial motivation for this change was to make a subsequent change
which'll also modify the refs variable smaller, since it won't have to
copy this redundant "NULL the last + 1 item" pattern.

Signed-off-by: Ævar Arnfjörð Bjarmason 
---
 builtin/fetch.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index 7bbcd26faf..b34665db9e 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1302,7 +1302,6 @@ static int fetch_one(struct remote *remote, int argc, 
const char **argv)
} else
refs[j++] = argv[i];
}
-   refs[j] = NULL;
ref_nr = j;
}
 
-- 
2.15.1.424.g9478a66081