summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-11-13 10:22:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-11-13 20:21:06 (GMT)
commitc6893323917cbf4cb66c29ba2ac03014a44f0f0c (patch)
treecc14f88d5ebfd114e5c80f74506eff6c9a5fa68b /cache.h
parentbc1bbe0c19a6ff39522b4fa3259f34150e308e1f (diff)
downloadgit-c6893323917cbf4cb66c29ba2ac03014a44f0f0c.zip
git-c6893323917cbf4cb66c29ba2ac03014a44f0f0c.tar.gz
git-c6893323917cbf4cb66c29ba2ac03014a44f0f0c.tar.bz2
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>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 2e6ad36..5badece 100644
--- a/cache.h
+++ b/cache.h
@@ -832,6 +832,8 @@ static inline int get_sha1_with_context(const char *str, unsigned char *sha1, st
extern int get_sha1_hex(const char *hex, unsigned char *sha1);
extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
+extern int read_ref_full(const char *filename, unsigned char *sha1,
+ int reading, int *flags);
extern int read_ref(const char *filename, unsigned char *sha1);
/*