diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2011-12-12 18:20:32 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-12-13 09:39:46 -0800 |
commit | 8cad4744ee37ebec1d9491a1381ec1771a1ba795 (patch) | |
tree | 064bbe938f38727dd163aae9c95e2185b8075234 /builtin/symbolic-ref.c | |
parent | Convert resolve_ref+xstrdup to new resolve_refdup function (diff) | |
download | tgif-8cad4744ee37ebec1d9491a1381ec1771a1ba795.tar.xz |
Rename resolve_ref() to resolve_ref_unsafe()
resolve_ref() may return a pointer to a shared buffer and can be
overwritten by the next resolve_ref() calls. Callers need to
pay attention, not to keep the pointer when the next call happens.
Rename with "_unsafe" suffix to warn developers (or reviewers) before
introducing new call sites.
This patch is generated using the following command
git grep -l 'resolve_ref(' -- '*.[ch]'|xargs sed -i 's/resolve_ref(/resolve_ref_unsafe(/g'
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/symbolic-ref.c')
-rw-r--r-- | builtin/symbolic-ref.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index dea849c3c5..2ef5962386 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -12,7 +12,7 @@ static void check_symref(const char *HEAD, int quiet) { unsigned char sha1[20]; int flag; - const char *refs_heads_master = resolve_ref(HEAD, sha1, 0, &flag); + const char *refs_heads_master = resolve_ref_unsafe(HEAD, sha1, 0, &flag); if (!refs_heads_master) die("No such ref: %s", HEAD); |