aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2013-08-08 10:42:39 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-08-20 11:33:29 +0300
commit30f5bc782c0cd599aecce545ba18254ec4c5f058 (patch)
tree2a134a86fcb317de1cf6a05890c5870def4387ae
parent44c47f0d0ee03c52d33a02c381c96c7809c9a148 (diff)
downloadpacrunner-30f5bc782c0cd599aecce545ba18254ec4c5f058.tar.gz
plugins: Do not compare expression against NULL
This patch generate via coccinelle with: @ disable is_null,isnt_null1 @ expression E; @@ ( - E == NULL + !E | - E != NULL + E )
-rw-r--r--plugins/curl.c4
-rw-r--r--plugins/mozjs.c16
2 files changed, 10 insertions, 10 deletions
diff --git a/plugins/curl.c b/plugins/curl.c
index 9ca7ff0..b8ab1bf 100644
--- a/plugins/curl.c
+++ b/plugins/curl.c
@@ -66,7 +66,7 @@ static void check_sockets(CURLM *multi, CURLMcode result, int handles)
do {
msg = curl_multi_info_read(multi, &msgs_left);
- if (msg == NULL)
+ if (!msg)
break;
if (msg->msg != CURLMSG_DONE)
@@ -274,7 +274,7 @@ static int curl_download(const char *interface, const char *url,
DBG("url %s", url);
download = g_try_new0(struct download_data, 1);
- if (download == NULL)
+ if (!download)
return -ENOMEM;
download->url = g_strdup(url);
diff --git a/plugins/mozjs.c b/plugins/mozjs.c
index 766df75..9d1ad6f 100644
--- a/plugins/mozjs.c
+++ b/plugins/mozjs.c
@@ -100,11 +100,11 @@ static JSBool myipaddress(JSContext *ctx, uintN argc, jsval *vp)
JS_SET_RVAL(ctx, vp, JSVAL_NULL);
- if (current_proxy == NULL)
+ if (!current_proxy)
return JS_TRUE;
interface = pacrunner_proxy_get_interface(current_proxy);
- if (interface == NULL)
+ if (!interface)
return JS_TRUE;
if (getaddr(interface, address, sizeof(address)) < 0)
@@ -157,11 +157,11 @@ static void create_object(void)
const char *script;
jsval rval;
- if (current_proxy == NULL)
+ if (!current_proxy)
return;
script = pacrunner_proxy_get_script(current_proxy);
- if (script == NULL)
+ if (!script)
return;
jsctx = JS_NewContext(jsrun, 8 * 1024);
@@ -187,7 +187,7 @@ static void create_object(void)
static void destroy_object(void)
{
- if (jsctx == NULL)
+ if (!jsctx)
return;
JS_DestroyContext(jsctx);
@@ -200,12 +200,12 @@ static int mozjs_set_proxy(struct pacrunner_proxy *proxy)
{
DBG("proxy %p", proxy);
- if (current_proxy != NULL)
+ if (current_proxy)
destroy_object();
current_proxy = proxy;
- if (current_proxy != NULL)
+ if (current_proxy)
create_object();
return 0;
@@ -219,7 +219,7 @@ static char * mozjs_execute(const char *url, const char *host)
DBG("url %s host %s", url, host);
- if (jsctx == NULL)
+ if (!jsctx)
return NULL;
pthread_mutex_lock(&mozjs_mutex);