]> granicus.if.org Git - python/commitdiff
Some more changes to make code compile under a C++ compiler.
authorAnthony Baxter <anthonybaxter@gmail.com>
Tue, 11 Apr 2006 12:14:09 +0000 (12:14 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Tue, 11 Apr 2006 12:14:09 +0000 (12:14 +0000)
Modules/gcmodule.c
Modules/getpath.c
Modules/main.c
Modules/posixmodule.c
Python/pystrtod.c

index 5bf95b9185a0342fd86bd8190b0c979177f3cc33..5d9e548a5933b16a68350bdc16afe0acd3a34ad8 100644 (file)
@@ -1281,7 +1281,8 @@ PyObject *
 _PyObject_GC_Malloc(size_t basicsize)
 {
        PyObject *op;
-       PyGC_Head *g = PyObject_MALLOC(sizeof(PyGC_Head) + basicsize);
+       PyGC_Head *g = (PyGC_Head *)PyObject_MALLOC(
+                sizeof(PyGC_Head) + basicsize);
        if (g == NULL)
                return PyErr_NoMemory();
        g->gc.gc_refs = GC_UNTRACKED;
@@ -1323,7 +1324,7 @@ _PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems)
 {
        const size_t basicsize = _PyObject_VAR_SIZE(op->ob_type, nitems);
        PyGC_Head *g = AS_GC(op);
-       g = PyObject_REALLOC(g,  sizeof(PyGC_Head) + basicsize);
+       g = (PyGC_Head *)PyObject_REALLOC(g,  sizeof(PyGC_Head) + basicsize);
        if (g == NULL)
                return (PyVarObject *)PyErr_NoMemory();
        op = (PyVarObject *) FROM_GC(g);
index 4716d154587e6dac1cb3d3ac40ddcb44de7498ce..40c36921a6100e141e9d13695a6ed4984ba9da35 100644 (file)
@@ -566,7 +566,7 @@ calculate_path(void)
     bufsz += strlen(exec_prefix) + 1;
 
     /* This is the only malloc call in this file */
-    buf = PyMem_Malloc(bufsz);
+    buf = (char *)PyMem_Malloc(bufsz);
 
     if (buf == NULL) {
         /* We can't exit, so print a warning and limp along */
index 913e82e31962e3700f36d84265d90f081d4f0710..ceb5bedb777ae0fe6ed97bf8d711ede3b8c917ee 100644 (file)
@@ -208,7 +208,7 @@ Py_Main(int argc, char **argv)
                        /* -c is the last option; following arguments
                           that look like options are left for the
                           command to interpret. */
-                       command = malloc(strlen(_PyOS_optarg) + 2);
+                       command = (char *)malloc(strlen(_PyOS_optarg) + 2);
                        if (command == NULL)
                                Py_FatalError(
                                   "not enough memory to copy -c argument");
@@ -221,7 +221,7 @@ Py_Main(int argc, char **argv)
                        /* -m is the last option; following arguments
                           that look like options are left for the
                           module to interpret. */
-                       module = malloc(strlen(_PyOS_optarg) + 2);
+                       module = (char *)malloc(strlen(_PyOS_optarg) + 2);
                        if (module == NULL)
                                Py_FatalError(
                                   "not enough memory to copy -m argument");
index a0a8d9a8e68574d5a0eab42a2b7741eabfc5c6ef..4cd220e425afb3f946cfece799ea09677a37da52 100644 (file)
@@ -6009,7 +6009,7 @@ static PyObject *
 posix_putenv(PyObject *self, PyObject *args)
 {
         char *s1, *s2;
-        char *new;
+        char *newenv;
        PyObject *newstr;
        size_t len;
 
@@ -6040,9 +6040,9 @@ posix_putenv(PyObject *self, PyObject *args)
        newstr = PyString_FromStringAndSize(NULL, (int)len - 1);
        if (newstr == NULL)
                return PyErr_NoMemory();
-       new = PyString_AS_STRING(newstr);
-       PyOS_snprintf(new, len, "%s=%s", s1, s2);
-       if (putenv(new)) {
+       newenv = PyString_AS_STRING(newstr);
+       PyOS_snprintf(newenv, len, "%s=%s", s1, s2);
+       if (putenv(newenv)) {
                 Py_DECREF(newstr);
                 posix_error();
                 return NULL;
index 83e792db1e38077896d7ab163a90a221a4c2cf03..db4cad17d7524036e4d2639ad907b3e37a35615b 100644 (file)
@@ -101,7 +101,7 @@ PyOS_ascii_strtod(const char *nptr, char **endptr)
                char *copy, *c;
 
                /* We need to convert the '.' to the locale specific decimal point */
-               copy = malloc(end - nptr + 1 + decimal_point_len);
+               copy = (char *)malloc(end - nptr + 1 + decimal_point_len);
 
                c = copy;
                memcpy(c, nptr, decimal_point_pos - nptr);