diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-04-16 23:29:26 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-16 23:29:26 -0700 |
commit | cb054eb26452e07a3cb34703e1579b97f5c7e6ab (patch) | |
tree | bdb83f6ceb82421f173934431c1299dc167dbd06 /builtin/checkout.c | |
parent | Eleventh batch for 2.13 (diff) | |
parent | daemon: use an argv_array to exec children (diff) | |
download | tgif-cb054eb26452e07a3cb34703e1579b97f5c7e6ab.tar.xz |
Merge branch 'jk/snprintf-cleanups'
Code clean-up.
* jk/snprintf-cleanups:
daemon: use an argv_array to exec children
gc: replace local buffer with git_path
transport-helper: replace checked snprintf with xsnprintf
convert unchecked snprintf into xsnprintf
combine-diff: replace malloc/snprintf with xstrfmt
replace unchecked snprintf calls with heap buffers
receive-pack: print --pack-header directly into argv array
name-rev: replace static buffer with strbuf
create_branch: use xstrfmt for reflog message
create_branch: move msg setup closer to point of use
avoid using mksnpath for refs
avoid using fixed PATH_MAX buffers for refs
fetch: use heap buffer to format reflog
tag: use strbuf to format tag header
diff: avoid fixed-size buffer for patch-ids
odb_mkstemp: use git_path_buf
odb_mkstemp: write filename into strbuf
do not check odb_mkstemp return value for errors
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r-- | builtin/checkout.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index 3ecc47bec0..bfa5419f33 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -908,11 +908,10 @@ static int check_tracking_name(struct remote *remote, void *cb_data) static const char *unique_tracking_name(const char *name, struct object_id *oid) { struct tracking_name_data cb_data = { NULL, NULL, NULL, 1 }; - char src_ref[PATH_MAX]; - snprintf(src_ref, PATH_MAX, "refs/heads/%s", name); - cb_data.src_ref = src_ref; + cb_data.src_ref = xstrfmt("refs/heads/%s", name); cb_data.dst_oid = oid; for_each_remote(check_tracking_name, &cb_data); + free(cb_data.src_ref); if (cb_data.unique) return cb_data.dst_ref; free(cb_data.dst_ref); |