[physfs] Replace malloc/strcpy by strdup

Christoph Nelles evilazrael at evilazrael.de
Wed Sep 29 11:33:54 EDT 2010


yes, looks like this is a problem:

And you are forced to use free(). allocator.malloc/free may use other

So why worrying about saving one LOC.

Am 29.09.2010 17:25, schrieb Tim Cas:
> Correct me if I'm wrong, but strdup doesn't seem to be a part of the
C90 or C99 standard, but rather POSIX (which is a problem in Windows).
> Compare:
> http://www.opengroup.org/onlinepubs/009695399/basedefs/string.h.html
(POSIX implementation)
> http://www.cplusplus.com/reference/clibrary/cstring/ (C99 and/or C++
> On 29 September 2010 15:27, Tolga Dalman <tolga.dalman at googlemail.com
<mailto:tolga.dalman at googlemail.com>> wrote:
> Hi,
> the attached patch replaces a malloc and strdup sequence by a plain
> strdup. Also, I fixed a trivial copy & paste error in the error
> checking path.
> Thanks
> Tolga Dalman

physfs mailing list
physfs at icculus.org <mailto:physfs at icculus.org>

> _______________________________________________
> physfs mailing list
> physfs at icculus.org
> http://icculus.org/mailman/listinfo/physfs

Christoph Nelles

E-Mail    : evilazrael at evilazrael.de
Jabber    : eazrael at evilazrael.net      ICQ       : 78819723

PGP-Key   : ID 0x424FB55B on subkeys.pgp.net
            or http://evilazrael.net/pgp.txt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/physfs/attachments/20100929/c4e1e497/attachment.htm>

More information about the physfs mailing list