[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Objects object.c,2.95,2.96 (original) (raw)
Trent Mick trentm@ActiveState.com
Fri, 18 Aug 2000 10:23:39 -0700
- Previous message: [Python-Dev] Adding insint() function
- Next message: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Objects object.c,2.95,2.96
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Aug 17, 2000 at 10:01:22PM -0700, Barry Warsaw wrote:
Update of /cvsroot/python/python/dist/src/Objects In directory slayer.i.sourceforge.net:/tmp/cvs-serv28173
Modified Files: object.c Log Message: makepair(): When comparing the pointers, they must be cast to integer types (i.e. Pyuintptrt, our spelling of C9X's uintptrt). 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.95 retrieving revision 2.96 diff -C2 -r2.95 -r2.96 *** object.c 2000/08/16 12:24:51 2.95 --- object.c 2000/08/18 05:01:19 2.96 *************** *** 372,375 **** --- 372,377 ---- { PyObject *pair; + Pyuintptrt iv = (Pyuintptrt)v; + Pyuintptrt iw = (Pyuintptrt)w; pair = PyTupleNew(2); *************** *** 377,381 **** return NULL; } ! if (v <= w) {_ _PyTupleSETITEM(pair, 0, PyLongFromVoidPtr((void *)v));_ _PyTupleSETITEM(pair, 1, PyLongFromVoidPtr((void *)w));_ _--- 379,383 ----_ _return NULL;_ _}_ _! if (iv <= iw) {_ _PyTupleSETITEM(pair, 0, PyLongFromVoidPtr((void *)v));_ _PyTupleSETITEM(pair, 1, PyLongFromVoidPtr((void *)w));_ _***************_ _*** 488,492 ****_ _}_ _if (vtp->tpcompare == NULL) { ! return (v < w) ? -1 : 1;_ _}_ _PyCompareStatenesting++;_ _--- 490,496 ----_ _}_ _if (vtp->tpcompare == NULL) { ! Pyuintptrt iv = (Pyuintptrt)v; ! Pyuintptrt iw = (Pyuintptrt)w; ! return (iv < iw) ? -1 : 1; } PyCompareStatenesting++;
Can't you just do the cast for the comparison instead of making new variables?
Trent
-- Trent Mick TrentM@ActiveState.com
- Previous message: [Python-Dev] Adding insint() function
- Next message: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Objects object.c,2.95,2.96
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]