[Python-checkins] CVS: python/dist/src/Objects object.c,2.109,2.110

Barry Warsaw bwarsaw@users.sourceforge.net
Fri, 19 Jan 2001 22:08:13 -0800


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv19608

Modified Files:
	object.c 
Log Message:
default_3way_compare(): When comparing the pointers, they must be cast
to integer types (i.e. Py_uintptr_t, our spelling of C9X's uintptr_t).
ANSI specifies that pointer compares other than == and != to
non-related structures are undefined.  This quiets an Insure
portability warning.


Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.109
retrieving revision 2.110
diff -C2 -r2.109 -r2.110
*** object.c	2001/01/18 23:33:37	2.109
--- object.c	2001/01/20 06:08:10	2.110
***************
*** 526,531 ****
  	if (v->ob_type == w->ob_type) {
  		/* same type: compare pointers */
! 		void *vv = v;
! 		void *ww = w;
  		return (vv < ww) ? -1 : (vv > ww) ? 1 : 0;
  	}
--- 526,531 ----
  	if (v->ob_type == w->ob_type) {
  		/* same type: compare pointers */
! 		Py_uintptr_t vv = (Py_uintptr_t)v;
! 		Py_uintptr_t ww = (Py_uintptr_t)w;
  		return (vv < ww) ? -1 : (vv > ww) ? 1 : 0;
  	}