From c48b97b1187971a7b545921bfdc961e9ad53f0a6 Mon Sep 17 00:00:00 2001 From: Yunlian Jiang Date: Wed, 5 Feb 2014 16:08:07 -0800 Subject: [PATCH] libqcdm: use NULL instead of 0 for empty pointer When I use clang 3.5 to build it, I got commands.c:1444:16: error: expression which evaluates to zero treated as a null pointer constant of type 'QcdmResult *' (aka 'struct QcdmResult *') [-Werror,-Wnon-literal-null-conversion] return FALSE; ^~~~~ ./utils.h:29:15: note: expanded from macro 'FALSE' #define FALSE ((u_int8_t) 0) ^~~~~~~~~~~~~~ commands.c:1464:20: error: expression which evaluates to zero treated as a null pointer constant of type 'QcdmResult *' (aka 'struct QcdmResult *') [-Werror,-Wnon-literal-null-conversion] return FALSE; ^~~~~ ./utils.h:29:15: note: expanded from macro 'FALSE' #define FALSE ((u_int8_t) 0) ^~~~~~~~~~~~~~ 2 errors generated. make[3]: *** [libqcdm_la-commands.lo] Error 1 make[3]: *** Waiting for unfinished jobs.... Below is the patch that fixes it --- libqcdm/src/commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libqcdm/src/commands.c b/libqcdm/src/commands.c index ff7d2328..fe436e97 100644 --- a/libqcdm/src/commands.c +++ b/libqcdm/src/commands.c @@ -1441,7 +1441,7 @@ qcdm_cmd_ext_logmask_result (const char *buf, size_t len, int *out_error) if (len < 1) { qcdm_err (0, "DM command %d response not long enough (got %zu, expected " "at least %d).", DIAG_CMD_EXT_LOGMASK, len, 3); - return FALSE; + return NULL; } /* Result of a 'set' operation will be only 1 byte in size; result of @@ -1461,7 +1461,7 @@ qcdm_cmd_ext_logmask_result (const char *buf, size_t len, int *out_error) if (len < (masklen + 3)) { qcdm_err (0, "DM command %d response not long enough (got %zu, expected " "at least %d).", DIAG_CMD_EXT_LOGMASK, len, masklen + 3); - return FALSE; + return NULL; } minlen = masklen + 3; }