Skip to content
  • Duy Nguyen's avatar
    path.c: make get_pathname() return strbuf instead of static buffer · 4ef9caf5
    Duy Nguyen authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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
    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: default avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    4ef9caf5