[PATCH 1/5] receive-pack: don't copy "dir" parameter
- From
Jeff King <peff@peff.net>
- Date
- Jul 24, 2014, 04:40 UTC
- Message-ID
- <20140724044042.GA32355@peff.net>
- In-Reply-To
- <20140724043940.GA31282@peff.net>
We used to do this so could pass a mutable string to enter_repo. But since 1c64b48 (enter_repo: do not modify input, 2011-10-04), this is not necessary.
The resulting code is simpler, and it fixes a minor leak.
Signed-off-by: Jeff King <peff@peff.net> --- If you are wondering whether upload-pack needs the same treatment, we already did it in 6379dd0.
builtin/receive-pack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 92561bf..f93ac45 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1122,7 +1122,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix) int advertise_refs = 0; int stateless_rpc = 0; int i; - char *dir = NULL; + const char *dir = NULL; struct command *commands; struct sha1_array shallow = SHA1_ARRAY_INIT; struct sha1_array ref = SHA1_ARRAY_INIT; @@ -1157,7 +1157,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix) } if (dir) usage(receive_pack_usage); - dir = xstrdup(arg); + dir = arg; } if (!dir) usage(receive_pack_usage);
-- 2.0.0.566.gfe3e6b2