Mercurial > cpython-lru_cache-weakref
annotate Python/strdup.c @ 13163:a09e8635534d legacy-trunk
Don't try to guess the name of a .def file -- if one is supplied, use it,
otherwise just generate an '/export:' option.
| author | Greg Ward <gward@python.net> |
|---|---|
| date | Thu, 29 Jun 2000 23:09:20 +0000 |
| parents | 8efa37a770c6 |
| children | f79434ee41fa |
| rev | line source |
|---|---|
| 4174 | 1 /* strdup() replacement (from stdwin, if you must know) */ |
| 2 | |
|
9970
8efa37a770c6
Patches by William Lewis for Nextstep descendants.
Guido van Rossum <guido@python.org>
parents:
4175
diff
changeset
|
3 #include "pgenheaders.h" |
| 4174 | 4 |
| 5 char * | |
| 6 strdup(str) | |
| 7 const char *str; | |
| 8 { | |
| 9 if (str != NULL) { | |
| 10 register char *copy = malloc(strlen(str) + 1); | |
| 11 if (copy != NULL) | |
| 12 return strcpy(copy, str); | |
| 13 } | |
| 14 return NULL; | |
| 15 } |
