Mercurial > cpython-lru_cache-weakref
diff Modules/parsermodule.c @ 6469:dca9bdf5ea08 legacy-trunk
Remove requirement for strdup() since it causes so many troubles for too many
platforms. Argh!
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Thu, 09 Oct 1997 16:29:31 +0000 |
| parents | c142eb533fb9 |
| children | f42b757755eb |
line wrap: on
line diff
--- a/Modules/parsermodule.c Wed Oct 08 22:49:49 1997 +0000 +++ b/Modules/parsermodule.c Thu Oct 09 16:29:31 1997 +0000 @@ -26,9 +26,6 @@ /* ISTERMINAL() / ISNONTERMINAL() */ #include "compile.h" /* PyNode_Compile() */ -#ifndef MS_WINDOWS -char *strdup(); -#endif /* String constants used to initialize module attributes. * @@ -747,7 +744,10 @@ if (check_terminal_tuple(elem)) { PyObject *temp = PySequence_GetItem(elem, 1); - strn = strdup(PyString_AsString(temp)); + /* check_terminal_tuple() already verified it's a string */ + strn = (char *)malloc(PyString_GET_SIZE(temp) + 1); + if (strn != NULL) + strcpy(strn, PyString_AS_STRING(temp)); Py_XDECREF(temp); if (PyObject_Length(elem) == 3) {
