git_snpath(): retire and replace with strbuf_git_path()
In the previous patch, git_snpath() is modified to allocate a new strbuf buffer because vsnpath() needs that. But that makes it awkward because git_snpath() receives a pre-allocated buffer from outside and has to copy data back. Rename it to strbuf_git_path() and make it receive strbuf directly. Using git_path() in update_refs_for_switch() which used to call git_snpath() is safe because that function and all of its callers do not keep any pointer to the round-robin buffer pool allocated by get_pathname(). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
dcf692625a
commit
1a83c240f2
2
refs.h
2
refs.h
@ -210,7 +210,7 @@ extern void unlock_ref(struct ref_lock *lock);
|
||||
/*
|
||||
* Setup reflog before using. Set errno to something meaningful on failure.
|
||||
*/
|
||||
int log_ref_setup(const char *refname, char *logfile, int bufsize);
|
||||
int log_ref_setup(const char *refname, struct strbuf *logfile);
|
||||
|
||||
/** Reads log for the value of ref during at_time. **/
|
||||
extern int read_ref_at(const char *refname, unsigned int flags,
|
||||
|
Reference in New Issue
Block a user