Re: [PATCH v5 01/28] path.c: make get_pathname() return strbuf instead of static buffer
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Mar 8, 2014, 06:11 UTC
- Message-ID
- <531AB47B.7070506@web.de>
- In-Reply-To
- <1394246900-31535-2-git-send-email-pclouds@gmail.com>
On 2014-03-08 03.47, Nguyễn Thái Ngọc Duy wrote:
Show 6 quoted lines
> We've been avoiding PATH_MAX whenever possible. This patch makes > get_pathname() return a strbuf and updates the callers to take > advantage of this. The code is simplified as we no longer need to > worry about buffer overflow. > > vsnpath() behavior is changed slightly: previously it always clears
Minor question: Is the function name vsnpath() appropriate any more ? How about renaming the function into strbuf_vaddpath() ?
Show 6 quoted lines
> the buffer before writing, now it just appends. Fortunately this is a > static function and all of its callers prepare the buffer properly: > git_path() gets the buffer from get_pathname() which resets the > buffer, the remaining call sites start with STRBUF_INIT'd buffer. > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>