diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-03-23 15:53:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-23 15:53:47 (GMT) |
commit | 0b3ec192259a65971001ce8f0de85a9c1e71d9c7 (patch) | |
tree | a1be55ac1679e3b80ccb4cc2e31c5c57fc4bbdc9 | |
parent | aefa7ebf0ff0f73feee7ab24f4cdcb2014d83ee5 (diff) | |
download | cpython-0b3ec192259a65971001ce8f0de85a9c1e71d9c7.zip cpython-0b3ec192259a65971001ce8f0de85a9c1e71d9c7.tar.gz cpython-0b3ec192259a65971001ce8f0de85a9c1e71d9c7.tar.bz2 |
Use NULL rather than 0. (#778)
There was few cases of using literal 0 instead of NULL in the context of
pointers. While this was a legitimate C code, using NULL rather than 0 makes
the code clearer.
-rw-r--r-- | Modules/_csv.c | 16 | ||||
-rw-r--r-- | Modules/_ctypes/callproc.c | 2 | ||||
-rw-r--r-- | Modules/_cursesmodule.c | 2 | ||||
-rw-r--r-- | Modules/_sqlite/connection.c | 2 | ||||
-rw-r--r-- | Modules/_sqlite/module.c | 2 | ||||
-rw-r--r-- | Modules/_tkinter.c | 2 | ||||
-rw-r--r-- | PC/bdist_wininst/install.c | 2 | ||||
-rw-r--r-- | Parser/listnode.c | 2 |
8 files changed, 15 insertions, 15 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c index fb5530a..5314ef6 100644 --- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -365,14 +365,14 @@ dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) Py_INCREF(dialect); /* Can we reuse this instance? */ if (PyObject_TypeCheck(dialect, &Dialect_Type) && - delimiter == 0 && - doublequote == 0 && - escapechar == 0 && - lineterminator == 0 && - quotechar == 0 && - quoting == 0 && - skipinitialspace == 0 && - strict == 0) + delimiter == NULL && + doublequote == NULL && + escapechar == NULL && + lineterminator == NULL && + quotechar == NULL && + quoting == NULL && + skipinitialspace == NULL && + strict == NULL) return dialect; } diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 9b368ca..0b6faf9 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -132,7 +132,7 @@ _ctypes_get_errobj(int **pspace) PyObject *dict = PyThreadState_GetDict(); PyObject *errobj; static PyObject *error_object_name; - if (dict == 0) { + if (dict == NULL) { PyErr_SetString(PyExc_RuntimeError, "cannot get thread state"); return NULL; diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 4d714ce..8f0a12b 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -2987,7 +2987,7 @@ PyCurses_tigetstr(PyObject *self, PyObject *args) return NULL; capname = tigetstr( capname ); - if (capname == 0 || capname == (char*) -1) { + if (capname == NULL || capname == (char*) -1) { Py_RETURN_NONE; } return PyBytes_FromString( capname ); diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 72156b9..fab77ef 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -643,7 +643,7 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_ aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*)); - if (*aggregate_instance == 0) { + if (*aggregate_instance == NULL) { *aggregate_instance = _PyObject_CallNoArg(aggregate_class); if (PyErr_Occurred()) { diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 72c3a7f..59406e1 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -434,7 +434,7 @@ PyMODINIT_FUNC PyInit__sqlite3(void) PyDict_SetItemString(dict, "OptimizedUnicode", (PyObject*)&PyUnicode_Type); /* Set integer constants */ - for (i = 0; _int_constants[i].constant_name != 0; i++) { + for (i = 0; _int_constants[i].constant_name != NULL; i++) { tmp_obj = PyLong_FromLong(_int_constants[i].constant_value); if (!tmp_obj) { goto error; diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index ff51674..7ed2b02 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -1378,7 +1378,7 @@ Tkapp_CallArgs(PyObject *args, Tcl_Obj** objStore, int *pobjc) else if (!(PyTuple_Check(args) || PyList_Check(args))) { objv[0] = AsObj(args); - if (objv[0] == 0) + if (objv[0] == NULL) goto finally; objc = 1; Tcl_IncrRefCount(objv[0]); diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c index 17cc30d..4f9ef6c 100644 --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -2179,7 +2179,7 @@ BOOL MyIsUserAnAdmin() // to leave the library loaded) if (0 == (shell32=LoadLibrary("shell32.dll"))) return FALSE; - if (0 == (pfnIsUserAnAdmin=(PFNIsUserAnAdmin)GetProcAddress(shell32, "IsUserAnAdmin"))) + if (NULL == (pfnIsUserAnAdmin=(PFNIsUserAnAdmin)GetProcAddress(shell32, "IsUserAnAdmin"))) return FALSE; return (*pfnIsUserAnAdmin)(); } diff --git a/Parser/listnode.c b/Parser/listnode.c index b5f8ad2..71300ae 100644 --- a/Parser/listnode.c +++ b/Parser/listnode.c @@ -28,7 +28,7 @@ listnode(FILE *fp, node *n) static void list1node(FILE *fp, node *n) { - if (n == 0) + if (n == NULL) return; if (ISNONTERMINAL(TYPE(n))) { int i; |