Mercurial > cpython-lru_cache-weakref
view Python/strdup.c @ 18830:fdb388f2df4e legacy-trunk
Don't "import *" from stat at all -- just import what's needed, and
do it back in copy_file() (not at module level).
| author | Greg Ward <gward@python.net> |
|---|---|
| date | Wed, 25 Jul 2001 19:48:03 +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; }
