summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1997-10-09 16:29:31 (GMT)
committerFred Drake <fdrake@acm.org>1997-10-09 16:29:31 (GMT)
commitd49266eeed612c60174a9ce53854bdc6dbae5fc1 (patch)
tree569ff80bccf7623c2405df53d4893251a24c0870 /Modules
parent764a377cef991fb030f99dd629f11a424289835a (diff)
downloadcpython-d49266eeed612c60174a9ce53854bdc6dbae5fc1.zip
cpython-d49266eeed612c60174a9ce53854bdc6dbae5fc1.tar.gz
cpython-d49266eeed612c60174a9ce53854bdc6dbae5fc1.tar.bz2
Remove requirement for strdup() since it causes so many troubles for too many
platforms. Argh!
Diffstat (limited to 'Modules')
-rw-r--r--Modules/parsermodule.c8
1 files 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) {