Skip to content

Commit 9de7ae6

Browse files
committed
Merge branch 'hn/path-ownership-comment'
Add comment to a few functions that use a short-lived buffer the caller can peek and copy out of. * hn/path-ownership-comment: read_gitfile_gently: clarify return value ownership. real_path: clarify return value ownership
2 parents 2f777fa + ea1d875 commit 9de7ae6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

abspath.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ char *strbuf_realpath(struct strbuf *resolved, const char *path,
202202
return retval;
203203
}
204204

205+
/*
206+
* Resolve `path` into an absolute, cleaned-up path. The return value
207+
* comes from a shared buffer.
208+
*/
205209
const char *real_path(const char *path)
206210
{
207211
static struct strbuf realpath = STRBUF_INIT;

setup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,8 @@ void read_gitfile_error_die(int error_code, const char *path, const char *dir)
541541

542542
/*
543543
* Try to read the location of the git directory from the .git file,
544-
* return path to git directory if found.
544+
* return path to git directory if found. The return value comes from
545+
* a shared buffer.
545546
*
546547
* On failure, if return_error_code is not NULL, return_error_code
547548
* will be set to an error code and NULL will be returned. If

0 commit comments

Comments
 (0)