From d49266eeed612c60174a9ce53854bdc6dbae5fc1 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Thu, 9 Oct 1997 16:29:31 +0000 Subject: Remove requirement for strdup() since it causes so many troubles for too many platforms. Argh! --- Modules/parsermodule.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 75b929b..9d624bc 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -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 @@ build_node_children(tuple, root, line_num) 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) { -- cgit v0.12