Mercurial > cpython-lru_cache-weakref
annotate Python/strdup.c @ 50518:072dedee77fa 3.0
Merged revisions 68216 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r68216 | antoine.pitrou | 2009-01-03 21:28:05 +0100 (sam., 03 janv. 2009) | 3 lines
Fix BytesWarning with -bb in wsgiref.headers.Headers.
........
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sat, 03 Jan 2009 21:38:35 +0000 |
| parents | f79434ee41fa |
| children | e7f6cef7a4cc |
| 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 * | |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
9970
diff
changeset
|
6 strdup(const char *str) |
| 4174 | 7 { |
| 8 if (str != NULL) { | |
| 9 register char *copy = malloc(strlen(str) + 1); | |
| 10 if (copy != NULL) | |
| 11 return strcpy(copy, str); | |
| 12 } | |
| 13 return NULL; | |
| 14 } |
