[open-source] Re: Wish for 2002 ...
Markus Friedl
markus@openbsd.org
Fri Jan 11 12:21:00 GMT 2002
On Fri, Jan 11, 2002 at 10:30:51AM -0800, Linus Torvalds wrote:
> > > len = strlen(challenge) + strlen(PROMPT) + 1;
> > > p = xmalloc(len);
> > > p[0] = '\0';
> > > strlcat(p, challenge, len);
> > > strlcat(p, PROMPT, len);
> > >
> > > Here, the use of strlcat is redundant: strcat would do just as well,
> > > and would be clearer, smaller, and no doubt faster.
> > >
> > > I expect your other examples are similar.
> >
> > The code will not be converted to use strcat().
>
> Nobody sane would convert it to strcat. The above code is CRAP.
>
> Who the h*ll is the idiot that does "concatenate the empty string with
> that string that I just took the length of", and then argues about strcat
> vs strlcat?
hey, get off your high horse, it's obvious that this should read 'cpy'
and not 'cat'. your flame neither makes the strncpy/strncat interface
more consistent nor easier to use than strlcpy/strlcat.
More information about the Libc-alpha
mailing list