Mercurial > cpython-lru_cache-weakref
annotate Python/strdup.c @ 6719:faebc1940432 legacy-trunk
Understand -Xlinker option.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 02 Dec 1997 20:38:11 +0000 |
| parents | bb5b9ff72de1 |
| children | 8efa37a770c6 |
| rev | line source |
|---|---|
| 4174 | 1 /* strdup() replacement (from stdwin, if you must know) */ |
| 2 | |
| 3 #include "config.h" | |
|
4175
bb5b9ff72de1
Needed more includes...
Guido van Rossum <guido@python.org>
parents:
4174
diff
changeset
|
4 #include "myproto.h" |
|
bb5b9ff72de1
Needed more includes...
Guido van Rossum <guido@python.org>
parents:
4174
diff
changeset
|
5 #include "mymalloc.h" |
| 4174 | 6 |
|
4175
bb5b9ff72de1
Needed more includes...
Guido van Rossum <guido@python.org>
parents:
4174
diff
changeset
|
7 #include <string.h> |
| 4174 | 8 |
| 9 char * | |
| 10 strdup(str) | |
| 11 const char *str; | |
| 12 { | |
| 13 if (str != NULL) { | |
| 14 register char *copy = malloc(strlen(str) + 1); | |
| 15 if (copy != NULL) | |
| 16 return strcpy(copy, str); | |
| 17 } | |
| 18 return NULL; | |
| 19 } |
