[uClibc]strndup

Erik Andersen andersen at codepoet.org
Wed Oct 10 21:45:05 UTC 2001


On Tue Oct 09, 2001 at 04:00:34PM -0700, Stefan Soucek wrote:
> Howdy,
> 
> I was wondering if uClibc currently supports strndup(). If've looked at the
> latest string.h and I find that the bottom section where bits/string2.h is
> included (which has a macro for strndup) is #if-0-ed out. Am I overlooking
> something here?

It just needs someone to write one.  The bits/string*.h stuff is commented out
since it is all inlines which produce big bloated binaries.  So if you need a
strndup, feel free to follow the example of how I've written everything in
libc/string/string.c.  Something I have tried to do (though not finished) is to
prevent the string functions from calling other functions.  This is because
most of them are smaller then 50 bytes, and so could (at some future date) be
added into a small uclibc-static lib so they could always be staticly linked
and still be a win by eliminating the cost of the elf vector code needed to fix
up the symbols when dynamically linking.  But that can only be guaranteed to be
a win of the code is small (~<50bytes) and makes no function calls...

 -Erik

--
Erik B. Andersen   email:  andersen at codepoet-consulting.com
--This message was written using 73% post-consumer electrons--





More information about the uClibc mailing list