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
This commit is contained in:
Lucas De Marchi 2010-08-21 13:52:25 +00:00
parent a0170084d5
commit d98f684bad
3 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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);