[Xcb] [PATCH xpyb 03/10] event.c: Delete explicit comparison with NULL

Tapasweni Pathak tapaswenipathak at gmail.com
Sun Oct 12 21:48:22 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 event.c file.

Signed-off-by: Tapasweni Pathak <tapaswenipathak at gmail.com>
---
 src/event.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/event.c b/src/event.c
index 2ab7eac..d166158 100644
--- a/src/event.c
+++ b/src/event.c
@@ -13,11 +13,11 @@ xpybEvent_create(xpybConn *conn, xcb_generic_event_t *e)
     unsigned char opcode = e->response_type & 0x7f;
     PyObject *shim, *event, *type = (PyObject *)&xpybEvent_type;

-    if (opcode < conn->events_len && conn->events[opcode] != NULL)
+    if (opcode < conn->events_len && conn->events[opcode])
 	type = conn->events[opcode];

     shim = PyBuffer_FromMemory(e, sizeof(*e));
-    if (shim == NULL)
+    if (!shim)
 	return NULL;

     event = PyObject_CallFunctionObjArgs(type, shim, NULL);
--
1.7.9.5



More information about the Xcb mailing list