diff Objects/longobject.c @ 37589:aeee85b6a5dd legacy-trunk

More C++-compliance. Note especially listobject.c - to get C++ to accept the PyTypeObject structures, I had to make prototypes for the functions, and move the structure definition ahead of the functions. I'd dearly like a better way to do this - to change this would make for a massive set of changes to the codebase. There's still some warnings - this is purely to get rid of errors first.
author Anthony Baxter <anthonybaxter@gmail.com>
date Tue, 11 Apr 2006 06:54:30 +0000
parents 213c4198fe23
children 7afaa752c772
line wrap: on
line diff
--- a/Objects/longobject.c	Tue Apr 11 06:47:43 2006 +0000
+++ b/Objects/longobject.c	Tue Apr 11 06:54:30 2006 +0000
@@ -1476,7 +1476,7 @@
 PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base)
 {
 	PyObject *result;
-	char *buffer = PyMem_MALLOC(length+1);
+	char *buffer = (char *)PyMem_MALLOC(length+1);
 
 	if (buffer == NULL)
 		return NULL;
@@ -3088,7 +3088,7 @@
 static PyObject *
 long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
-	PyLongObject *tmp, *new;
+	PyLongObject *tmp, *newobj;
 	Py_ssize_t i, n;
 
 	assert(PyType_IsSubtype(type, &PyLong_Type));
@@ -3099,17 +3099,17 @@
 	n = tmp->ob_size;
 	if (n < 0)
 		n = -n;
-	new = (PyLongObject *)type->tp_alloc(type, n);
-	if (new == NULL) {
+	newobj = (PyLongObject *)type->tp_alloc(type, n);
+	if (newobj == NULL) {
 		Py_DECREF(tmp);
 		return NULL;
 	}
-	assert(PyLong_Check(new));
-	new->ob_size = tmp->ob_size;
+	assert(PyLong_Check(newobj));
+	newobj->ob_size = tmp->ob_size;
 	for (i = 0; i < n; i++)
-		new->ob_digit[i] = tmp->ob_digit[i];
+		newobj->ob_digit[i] = tmp->ob_digit[i];
 	Py_DECREF(tmp);
-	return (PyObject *)new;
+	return (PyObject *)newobj;
 }
 
 static PyObject *