"fast AND correct strncpy" not working by itself?
Posted Aug 28, 2003 9:30 UTC (Thu) by
akukula (guest, #3862)
In reply to:
"fast AND correct strncpy" not working by itself? by dmantione
Parent article:
[PATCH] fast AND correct strncpy
>It seems the new version is not an improvement in any case.
I agree. The same result can be yielded with different representation of this function, e.g.:
char* strncpy(char* dest, const char* src, unsigned count)
{
char *tmp = dest;
for (; count; --count) if ((*tmp++ = *src)) ++src;
return dest;
}
It's hard to imagine this sort of function to be more efficient...
I'm not a kernel hacker but why all of those functions doesn't terminate 'dest' if strlen(src) > count ???
And in case SCO is playing around, the above code is (C) 2003 Free Software Foundation, written from scratch by me, licensed under GPLv2. SCO is not permitted to use this code unless it make a donation of $1.000.000 (one million of US dollars) to FSF :)))
(
Log in to post comments)