From d98f684badb059aa13ea638a18864ebfe9942283 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Sat, 21 Aug 2010 13:52:25 +0000 Subject: [PATCH] Convert (hopefully) all comparisons to NULL Apply badzero.cocci, badnull.coci and badnull2.cocci This should convert all cases where there's a comparison to NULL to simpler forms. This patch applies the following transformations: code before patch ||code after patch =============================================================== return a == NULL; return !a; return a != NULL; return !!a; func(a == NULL); func(!a); func(a != NULL); func(!!a); b = a == NULL; b = !a; b = a != NULL; b = !!a; b = a == NULL ? c : d; b = !a ? c : d; b = a != NULL ? c : d; b = a ? c : d; other cases: a == NULL !a a != NULL a SVN revision: 51487 --- src/e_mod_config.c | 4 ++-- src/e_mod_configure.c | 4 ++-- src/e_mod_net.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/e_mod_config.c b/src/e_mod_config.c index c10646a..b69fcb8 100644 --- a/src/e_mod_config.c +++ b/src/e_mod_config.c @@ -81,9 +81,9 @@ _net_config_devices_get(void) d = opendir("/dev/net"); if (!d) return NULL; - while ((dentry = readdir(d)) != NULL) + while ((dentry = readdir(d))) { - if (strstr(dentry->d_name,".") == NULL) + if (!strstr(dentry->d_name, ".")) devs = eina_list_append(devs, strdup(dentry->d_name)); } closedir(d); diff --git a/src/e_mod_configure.c b/src/e_mod_configure.c index 0285493..f08f016 100644 --- a/src/e_mod_configure.c +++ b/src/e_mod_configure.c @@ -157,7 +157,7 @@ _apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) ci = cfd->data; tmp = eina_list_nth(cfdata->devs, cfdata->num); - if (tmp != NULL) + if (tmp) { eina_stringshare_del(ci->device); ci->device = eina_stringshare_add(tmp); @@ -167,7 +167,7 @@ _apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) ci->show_popup = cfdata->show_popup; if (ci->app) eina_stringshare_del(ci->app); - if (cfdata->app != NULL) + if (cfdata->app) ci->app = eina_stringshare_add(cfdata->app); e_config_save_queue(); diff --git a/src/e_mod_net.c b/src/e_mod_net.c index 8112d93..f62e839 100644 --- a/src/e_mod_net.c +++ b/src/e_mod_net.c @@ -143,7 +143,7 @@ _net_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event) ev = event; if ((ev->button == 1) && (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)) { - if (inst->ci->app != NULL) + if (inst->ci->app) { x = ecore_exe_run(inst->ci->app, NULL); if (x) ecore_exe_free(x); @@ -187,7 +187,7 @@ _net_cb_mouse_in(void *data, Evas_Object *obj, const char *emission, const char char buf[PATH_MAX], tmp[100]; inst = data; - if (inst->popup != NULL) return; + if (inst->popup) return; if (!inst->ci->show_popup) return; inst->popup = e_gadcon_popup_new(inst->gcc);