Mercurial > cpython-lru_cache-weakref
view Python/strdup.c @ 68401:45d76bb9fbcd 3.2
merge 3.1
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 12 Mar 2011 11:58:40 -0600 |
| 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; }
