Mercurial > cpython-lru_cache-weakref
annotate Python/strdup.c @ 12357:5b59ea41db4e legacy-trunk
Install the docs (with fewer rules).
Add descriptions for the system variables.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 10 Apr 2000 19:36:27 +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 } |
