Mercurial > cpython-lru_cache-weakref
view Python/strdup.c @ 53635:abc80f8b0dfd legacy-trunk
Make the turtle.rst doctests pass. I have a feeling there should be
more cleanup, but I don't know now to kill turtles. Especially
unexpected ones... ;)
| author | R. David Murray <rdmurray@bitdance.com> |
|---|---|
| date | Thu, 30 Apr 2009 12:42:32 +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; }
