[Xcb] [PATCH xpyb 06/10] iter.c: Delete explicit comparison with NULL
Tapasweni Pathak
tapaswenipathak at gmail.com
Sun Oct 12 21:49:36 PDT 2014
if (pointer == NULL) is functionally equivalent to
if (!pointer).
Using the second will make it a bit obvious that there is a
pointer involved and not an integer or something.
This patch deletes explicit comaprison with NULL in iter.c file.
Signed-off-by: Tapasweni Pathak <tapaswenipathak at gmail.com>
---
src/iter.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/iter.c b/src/iter.c
index 5368f24..138a214 100644
--- a/src/iter.c
+++ b/src/iter.c
@@ -27,7 +27,7 @@ xpybIter_pop(xpybIter *self)
cur = PyList_GET_ITEM(self->stack, self->top);
item = PyIter_Next(cur);
- if (item == NULL) {
+ if (!item) {
if (PyErr_Occurred() || self->top < 1)
return NULL;
if (PyList_SetSlice(self->stack, self->top, self->top + 1, NULL) < 0)
@@ -38,7 +38,7 @@ xpybIter_pop(xpybIter *self)
if (PySequence_Check(item)) {
next = PyObject_GetIter(item);
- if (next == NULL)
+ if (!next)
goto err1;
if (PyList_Append(self->stack, next) < 0)
goto err2;
@@ -92,11 +92,11 @@ xpybIter_get(xpybIter *self)
Py_CLEAR(self->stack);
self->stack = PyList_New(1);
- if (self->stack == NULL)
+ if (!self->stack)
return NULL;
iterator = PyObject_GetIter(self->list);
- if (iterator == NULL)
+ if (!iterator)
return NULL;
PyList_SET_ITEM(self->stack, 0, iterator);
@@ -113,12 +113,12 @@ xpybIter_next(xpybIter *self)
Py_ssize_t i;
tuple = PyTuple_New(self->groupsize);
- if (tuple == NULL)
+ if (!tuple)
return NULL;
for (i = 0; i < self->groupsize; i++) {
tmp = xpybIter_pop(self);
- if (tmp == NULL) {
+ if (!tmp) {
if (i > 0 && !PyErr_Occurred())
xpybIter_err(self);
goto end;
--
1.7.9.5
More information about the Xcb
mailing list