diff options
author | Guido van Rossum <guido@python.org> | 2003-02-03 15:28:19 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-02-03 15:28:19 (GMT) |
commit | 004a65c9b10718c9f0089125f3cbbfac2a754804 (patch) | |
tree | f062d9f975fc3fe37946dbb9a6e1419be68acea4 /Objects/longobject.c | |
parent | 7aa56c9a7f3b23fa5634ae62ae881a0c94f21ab6 (diff) | |
download | cpython-004a65c9b10718c9f0089125f3cbbfac2a754804.zip cpython-004a65c9b10718c9f0089125f3cbbfac2a754804.tar.gz cpython-004a65c9b10718c9f0089125f3cbbfac2a754804.tar.bz2 |
_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.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 2ccf414..c2d6ea7 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -264,11 +264,9 @@ int _PyLong_Sign(PyObject *vv) { 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); } @@ -278,10 +276,11 @@ _PyLong_NumBits(PyObject *vv) { PyLongObject *v = (PyLongObject *)vv; size_t result = 0; - int ndigits = ABS(v->ob_size); + 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) { digit msd = v->ob_digit[ndigits - 1]; |