Mercurial > cpython-lru_cache-weakref
annotate Python/strdup.c @ 7278:59d2761ba1cf legacy-trunk
Remove obsolete pagenumbering / pagestyle cruft.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Fri, 13 Feb 1998 07:08:56 +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 } |
