author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Sun, 13 Nov 2011 10:22:14 +0000 (17:22 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 13 Nov 2011 20:21:06 +0000 (12:21 -0800) | ||
commit | c6893323917cbf4cb66c29ba2ac03014a44f0f0c | |
tree | cc14f88d5ebfd114e5c80f74506eff6c9a5fa68b | tree | snapshot |
parent | bc1bbe0c19a6ff39522b4fa3259f34150e308e1f | commit | diff |
Convert many resolve_ref() calls to read_ref*() and ref_exists()
resolve_ref() may return a pointer to a static buffer, which is not
safe for long-term use because if another resolve_ref() call happens,
the buffer may be changed. Many call sites though do not care about
this buffer. They simply check if the return value is NULL or not.
Convert all these call sites to new wrappers to reduce resolve_ref()
calls from 57 to 34. If we change resolve_ref() prototype later on
to avoid passing static buffer out, this helps reduce changes.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
resolve_ref() may return a pointer to a static buffer, which is not
safe for long-term use because if another resolve_ref() call happens,
the buffer may be changed. Many call sites though do not care about
this buffer. They simply check if the return value is NULL or not.
Convert all these call sites to new wrappers to reduce resolve_ref()
calls from 57 to 34. If we change resolve_ref() prototype later on
to avoid passing static buffer out, this helps reduce changes.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 files changed:
builtin/branch.c | diff | blob | history | |
builtin/checkout.c | diff | blob | history | |
builtin/merge.c | diff | blob | history | |
builtin/remote.c | diff | blob | history | |
builtin/replace.c | diff | blob | history | |
builtin/show-ref.c | diff | blob | history | |
builtin/tag.c | diff | blob | history | |
bundle.c | diff | blob | history | |
cache.h | diff | blob | history | |
notes-merge.c | diff | blob | history | |
refs.c | diff | blob | history | |
remote.c | diff | blob | history |