Re: [PATCH] Add platform-independent .git "symlink"
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 3, 2008, 01:55 UTC
- Message-ID
- <alpine.LSU.1.00.0802030155240.7372@racer.site>
- In-Reply-To
- <8c5c35580802021047o41a7de9fi84a6b33f0f779e2e@mail.gmail.com>
Hi,
On Sat, 2 Feb 2008, Lars Hjemli wrote:
Show 14 quoted lines
> On Feb 2, 2008 7:19 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > > > On Sat, 2 Feb 2008, Lars Hjemli wrote: > > > > > + if (len < 10 || buf[len - 1] != '\n' || strncmp(buf, "GITDIR: ", 8)) > > > > Sorry, missed that earlier: How about > > > > if (!len || buf[len-1] != '\n' || prefixcmp(buf, "GITDIR: ")) > > > > instead? (buf does not need be NUL terminated for the prefixcmp(), since > > we just made sure it is LF terminated) > > That's true, although it feels a bit too clever for me ;-)
:-)
Show 9 quoted lines
> Maybe this as a compromise? > > static char buf[PATH_MAX + 9]; /* "GITDIR: " + "\n" */ > ... > if (!len || buf[len - 1] != '\n') > return NULL; > buf[len - 1] = '\0'; > if (prefixcmp(buf, "GITDIR: ")) > return NULL;
Sure!
Thanks, Dscho