Re: [PATCH v3] Expand ~ and ~user in core.excludesfile, commit.template
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Aug 29, 2008, 07:00 UTC
- Message-ID
- <48B79E9D.9000308@viscovery.net>
- In-Reply-To
- <quack.20080828T0209.lthmyixjyjx_-_@roar.cs.berkeley.edu>
Karl Chen schrieb:
> + const char *after_username = strchr_or_end(path+1, '/');
Use strchrnul() instead of a home-grown strchr_or_end().
> + struct passwd *pw = getpw_strspan(path+1, after_username); > + if (!pw) return NULL; > + return concatstr(buf, pw->pw_dir, after_username, sz);
You really should use the strbuf API here. Look for strbuf_detach() in the existing code.
-- Hannes