[Python-checkins] python/dist/src/Objects longobject.c,1.154,1.155
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Mon, 03 Feb 2003 07:28:24 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv21734
Modified Files:
longobject.c
Log Message:
_PyLong_Sign(): remove an assert that needed a variable ndigits that
wasn't used outside the assert (and hence caused a compiler warning
about an unused variable in NDEBUG mode). The assert wasn't very
useful any more.
_PyLong_NumBits(): moved the calculation of ndigits after asserting
that v != NULL.
Index: longobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -C2 -d -r1.154 -r1.155
*** longobject.c 2 Feb 2003 17:33:53 -0000 1.154
--- longobject.c 3 Feb 2003 15:28:19 -0000 1.155
***************
*** 265,273 ****
{
PyLongObject *v = (PyLongObject *)vv;
- const int ndigits = ABS(v->ob_size);
assert(v != NULL);
assert(PyLong_Check(v));
- assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0);
return v->ob_size == 0 ? 0 : (v->ob_size < 0 ? -1 : 1);
--- 265,271 ----
***************
*** 279,286 ****
PyLongObject *v = (PyLongObject *)vv;
size_t result = 0;
! int ndigits = ABS(v->ob_size);
assert(v != NULL);
assert(PyLong_Check(v));
assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0);
if (ndigits > 0) {
--- 277,285 ----
PyLongObject *v = (PyLongObject *)vv;
size_t result = 0;
! int ndigits;
assert(v != NULL);
assert(PyLong_Check(v));
+ ndigits = ABS(v->ob_size);
assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0);
if (ndigits > 0) {