Mercurial > cpython-lru_cache-weakref
view Python/strdup.c @ 19161:d64e059cd199 legacy-trunk
Add section on PEP 238 changes
Minor grammatical changes, reformattings, and an error fix from Keith Briggs
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Sat, 11 Aug 2001 03:06:50 +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; }
