diff options
author | Jeff King <peff@peff.net> | 2014-06-19 17:19:43 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-19 15:20:53 -0700 |
commit | 95244ae3dd49b3eed4dbfe09299b9d8847622218 (patch) | |
tree | b70932b2e4e8205c2f6f6b0cfcb88ca172c2d9d9 /http-push.c | |
parent | fa3f60b783b42e0d07c667a8f582c3df12791cec (diff) | |
download | git-95244ae3dd49b3eed4dbfe09299b9d8847622218.tar.gz |
use xstrdup instead of xmalloc + strcpy
This is one line shorter, and makes sure the length in the
malloc and copy steps match.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-push.c')
-rw-r--r-- | http-push.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/http-push.c b/http-push.c index de00d1693a..95650a0241 100644 --- a/http-push.c +++ b/http-push.c @@ -767,15 +767,13 @@ static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed) if (tag_closed && ctx->cdata) { if (!strcmp(ctx->name, DAV_ACTIVELOCK_OWNER)) { - lock->owner = xmalloc(strlen(ctx->cdata) + 1); - strcpy(lock->owner, ctx->cdata); + lock->owner = xstrdup(ctx->cdata); } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TIMEOUT)) { if (starts_with(ctx->cdata, "Second-")) lock->timeout = strtol(ctx->cdata + 7, NULL, 10); } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TOKEN)) { - lock->token = xmalloc(strlen(ctx->cdata) + 1); - strcpy(lock->token, ctx->cdata); + lock->token = xstrdup(ctx->cdata); git_SHA1_Init(&sha_ctx); git_SHA1_Update(&sha_ctx, lock->token, strlen(lock->token)); |