On Wed, Sep 23, 2009 at 03:56:55PM +0100, Anselm R Garbe wrote:
>Well you are right, I was assuming the sic.c context where all buffers
>are static and now used in a way that the last byte is always
>emergency terminator.
Well, that's true, but I don't like making that kind of
assumption. Someone less knowledgable might decide to reuse the
function in a context where it's not safe. At any rate, I've
updated kris/util.c to use memccpy instead:
static void
strlcpy(char *to, const char *from, int l) {
memccpy(to, from, '\0', l);
to[l-1] = '\0';
}
>Ah ok, you SLOC'ed it, I just checked with wc -l...
Well, as I tend to use quite a bit of white space, that's not
exactly fair. At any rate, sic.c is only 215 lines, and util.c
is only the ugly crap that POSIX botches so badly that it
doesn't do much more than clutter the main code.
-- Kris Maglione Beware of bugs in the above code; I have only proved it correct, not tried it. --Donald KnuthReceived on Wed Sep 23 2009 - 16:56:15 UTC
This archive was generated by hypermail 2.2.0 : Wed Sep 23 2009 - 17:00:03 UTC