git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/4] Clarify return value ownership of real_path and read_gitfile_gently

From
BWBrandon Williams <bmwill@google.com>
Date
Sep 25, 2017, 17:24 UTC
Message-ID
<20170925172446.GB35385@google.com>
In-Reply-To
<20170925155927.32328-3-hanwen@google.com>
On 09/25, Han-Wen Nienhuys wrote:
Show 17 quoted lines
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  abspath.c | 3 +++
>  setup.c   | 3 ++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/abspath.c b/abspath.c
> index 708aff8d4..792a2d533 100644
> --- a/abspath.c
> +++ b/abspath.c
> @@ -202,6 +202,9 @@ char *strbuf_realpath(struct strbuf *resolved, const char *path,
>  	return retval;
>  }
>  
> +/* Resolve `path` into an absolute, cleaned-up path. The return value
> + * comes from a global shared buffer and should not be freed.
> + */

nit: Our comment style requires the opening '/*' which starts a comment block to be on its own line.

Show 20 quoted lines
>  const char *real_path(const char *path)
>  {
>  	static struct strbuf realpath = STRBUF_INIT;
> diff --git a/setup.c b/setup.c
> index 6d8380acd..31853724c 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -541,7 +541,8 @@ void read_gitfile_error_die(int error_code, const char *path, const char *dir)
>  
>  /*
>   * Try to read the location of the git directory from the .git file,
> - * return path to git directory if found.
> + * return path to git directory if found. The return value comes from
> + * a shared pool and should not be freed.
>   *
>   * On failure, if return_error_code is not NULL, return_error_code
>   * will be set to an error code and NULL will be returned. If
> -- 
> 2.14.1.821.g8fa685d3b7-goog
> 
-- 
Brandon Williams
Previous: Han-Wen NienhuysNext: Junio C Hamano
Message 6 of 14 in “Assorted comment fixes”
  1. 0/4 Assorted comment fixesHan-Wen Nienhuys, Sep 25, 2017
  2. 1/4 Fix typo in submodule.hHan-Wen Nienhuys, Sep 25, 2017
  3. 3/4 Document submodule_to_gitdirHan-Wen Nienhuys, Sep 25, 2017
  4. Brandon WilliamsSep 25, 2017
  5. 2/4 Clarify return value ownership of real_path and read_gitfile_gentlyHan-Wen Nienhuys, Sep 25, 2017
  6. Brandon WilliamsSep 25, 2017
  7. Junio C HamanoSep 26, 2017
  8. 4/4 Move documentation of string_list into string-list.hHan-Wen Nienhuys, Sep 25, 2017
  9. Brandon WilliamsSep 25, 2017
  10. Stefan BellerSep 25, 2017
  11. Andrey RybakSep 27, 2017
  12. Junio C HamanoSep 26, 2017
  13. Junio C HamanoSep 26, 2017
  14. Han-Wen NienhuysSep 26, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.