[BusyBox] strdup versus xstrdup

Matt Kraai kraai at alumni.carnegiemellon.edu
Sat Nov 10 00:42:20 UTC 2001


Steve Merrifield wrote:
> Hi,
>  
> What is the feeling towards the use of strdup() versus xstrdup() ?
>  
> Some applets use one, some use the other. Some use both! I note
> one of the janitorial tasks is to replace the use of strdup() with
> xstrdup().
>  
> Is there a need for this? Is anyone working on it? Would anyone
> mind if I went through the entire tree and replaced all occurences
> of strdup() with xstrdup() ?

It should be fine to convert all of the strdup calls whose callers do
not check for a NULL return value to use xstrdup instead, since they
will just segfault anyway.  If the applet handles this condition, though,
it might be better to leave it alone.

Matt


---------------------------------------------
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/







More information about the busybox mailing list