[Python-checkins] r45546 - python/trunk/Modules/arraymodule.c

skip.montanaro python-checkins at python.org
Tue Apr 18 21:39:48 CEST 2006


Author: skip.montanaro
Date: Tue Apr 18 21:39:48 2006
New Revision: 45546

Modified:
   python/trunk/Modules/arraymodule.c
Log:
C++ compiler cleanup: a cast here, a cast there... still does not compile under C++ though...

Modified: python/trunk/Modules/arraymodule.c
==============================================================================
--- python/trunk/Modules/arraymodule.c	(original)
+++ python/trunk/Modules/arraymodule.c	Tue Apr 18 21:39:48 2006
@@ -1164,7 +1164,7 @@
 	register char *p, *q;
 	/* little buffer to hold items while swapping */
 	char tmp[256];	/* 8 is probably enough -- but why skimp */
-	assert(itemsize <= sizeof(tmp));
+	assert((size_t)itemsize <= sizeof(tmp));
 
 	if (self->ob_size > 1) {
 		for (p = self->ob_item,
@@ -1674,7 +1674,8 @@
 			}
 
 			self->ob_size -= slicelength;
-			self->ob_item = PyMem_REALLOC(self->ob_item, itemsize*self->ob_size);
+			self->ob_item = (char *)PyMem_REALLOC(self->ob_item,
+							      itemsize*self->ob_size);
 			self->allocated = self->ob_size;
 
 			return 0;
@@ -1866,7 +1867,7 @@
 				if (n > 0) {
 					arrayobject *self = (arrayobject *)a;
 					char *item = self->ob_item;
-					item = PyMem_Realloc(item, n);
+					item = (char *)PyMem_Realloc(item, n);
 					if (item == NULL) {
 						PyErr_NoMemory();
 						Py_DECREF(a);


More information about the Python-checkins mailing list