Silence gcc warning. (In function 'bytearray_init': warning: 'value' may be used uninitialized in this function).

This commit is contained in:
Mark Dickinson 2010-07-09 19:25:48 +00:00
parent 34d17debb7
commit 10de93a715
1 changed files with 2 additions and 0 deletions

View File

@ -33,6 +33,7 @@ _getbytevalue(PyObject* arg, int *value)
PyObject *index = PyNumber_Index(arg); PyObject *index = PyNumber_Index(arg);
if (index == NULL) { if (index == NULL) {
PyErr_Format(PyExc_TypeError, "an integer is required"); PyErr_Format(PyExc_TypeError, "an integer is required");
*value = -1;
return 0; return 0;
} }
face_value = PyLong_AsLong(index); face_value = PyLong_AsLong(index);
@ -42,6 +43,7 @@ _getbytevalue(PyObject* arg, int *value)
if (face_value < 0 || face_value >= 256) { if (face_value < 0 || face_value >= 256) {
/* this includes the OverflowError in case the long is too large */ /* this includes the OverflowError in case the long is too large */
PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)"); PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)");
*value = -1;
return 0; return 0;
} }