Mercurial > cpython-lru_cache-weakref
view Python/strdup.c @ 33091:48100a01ac7c 2.3
Ignore the locale's encoding if it is an empty string.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Thu, 12 Aug 2004 13:14:20 +0000 |
| parents | f79434ee41fa |
| children | e7f6cef7a4cc |
line wrap: on
line source
/* strdup() replacement (from stdwin, if you must know) */ #include "pgenheaders.h" char * strdup(const char *str) { if (str != NULL) { register char *copy = malloc(strlen(str) + 1); if (copy != NULL) return strcpy(copy, str); } return NULL; }
