[Xcb] [PATCH xpyb 04/10] except.c: Delete explicit comparison with NULL

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

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

diff --git a/src/except.c b/src/except.c
index 3e9ed3f..4ec4d52 100644
--- a/src/except.c
+++ b/src/except.c
@@ -9,28 +9,28 @@ PyObject *xpybExcept_proto;
 int xpybExcept_modinit(PyObject *m)
 {
     xpybExcept_base = PyErr_NewException("xcb.Exception", NULL, NULL);
-    if (xpybExcept_base == NULL)
+    if (!xpybExcept_base)
 	return -1;
     Py_INCREF(xpybExcept_base);
     if (PyModule_AddObject(m, "Exception", xpybExcept_base) < 0)
 	return -1;

     xpybExcept_conn = PyErr_NewException("xcb.ConnectException", xpybExcept_base, NULL);
-    if (xpybExcept_conn == NULL)
+    if (!xpybExcept_conn)
 	return -1;
     Py_INCREF(xpybExcept_conn);
     if (PyModule_AddObject(m, "ConnectException", xpybExcept_conn) < 0)
 	return -1;

     xpybExcept_ext = PyErr_NewException("xcb.ExtensionException", xpybExcept_base, NULL);
-    if (xpybExcept_ext == NULL)
+    if (!xpybExcept_ext)
 	return -1;
     Py_INCREF(xpybExcept_ext);
     if (PyModule_AddObject(m, "ExtensionException", xpybExcept_ext) < 0)
 	return -1;

     xpybExcept_proto = PyErr_NewException("xcb.ProtocolException", xpybExcept_base, NULL);
-    if (xpybExcept_proto == NULL)
+    if (!xpybExcept_proto)
 	return -1;
     Py_INCREF(xpybExcept_proto);
     if (PyModule_AddObject(m, "ProtocolException", xpybExcept_proto) < 0)
--
1.7.9.5



More information about the Xcb mailing list