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:
parent
c391c9c86a
commit
c6a4ea9d2f
|
@ -82,7 +82,7 @@ _fill_list(Evas_Object *obj)
|
|||
char *real;
|
||||
|
||||
if (!(d = opendir(getenv("HOME")))) return;
|
||||
while ((de = readdir(d)) != NULL)
|
||||
while ((de = readdir(d)))
|
||||
{
|
||||
char buff[PATH_MAX];
|
||||
|
||||
|
@ -122,7 +122,7 @@ _dir_has_subs(const char *path)
|
|||
|
||||
if (!path) return result;
|
||||
if (!(d = opendir(path))) return result;
|
||||
while ((de = readdir(d)) != NULL)
|
||||
while ((de = readdir(d)))
|
||||
{
|
||||
char buff[PATH_MAX];
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ _populate(Evas_Object *obj, const char *path, Elm_Genlist_Item *parent)
|
|||
}
|
||||
|
||||
if (wd->entry2) elm_entry_entry_set(wd->entry2, "");
|
||||
while ((dp = readdir(dir)) != NULL)
|
||||
while ((dp = readdir(dir)))
|
||||
{
|
||||
if (dp->d_name[0] == '.') continue; // TODO make this configurable
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ _get_value_in_key_string(const char *oldstring, char *key, char **value)
|
|||
{
|
||||
starttag = curlocater;
|
||||
endtag = curlocater + strlen(key);
|
||||
if ((endtag == NULL) || (*endtag != '='))
|
||||
if ((!endtag) || (*endtag != '='))
|
||||
{
|
||||
foundflag = 0;
|
||||
return -1;
|
||||
|
@ -160,10 +160,10 @@ _get_value_in_key_string(const char *oldstring, char *key, char **value)
|
|||
break;
|
||||
else
|
||||
starttag--;
|
||||
if (starttag == NULL) break;
|
||||
if (!starttag) break;
|
||||
}
|
||||
|
||||
while (NULL != endtag)
|
||||
while (endtag)
|
||||
{
|
||||
if (*endtag == '<')
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ _get_value_in_key_string(const char *oldstring, char *key, char **value)
|
|||
break;
|
||||
else
|
||||
endtag++;
|
||||
if (endtag == NULL) break;
|
||||
if (!endtag) break;
|
||||
}
|
||||
|
||||
if ((foundflag != 0) && (*starttag == '<') && (*endtag == '>'))
|
||||
|
@ -205,7 +205,7 @@ _strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int
|
|||
srcstring = eina_strbuf_string_get(srcbuf);
|
||||
curlocater = strstr(srcstring, key);
|
||||
|
||||
if (curlocater == NULL)
|
||||
if (!curlocater)
|
||||
insertflag = 1;
|
||||
else
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ _strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int
|
|||
tagtxtlen = endtag - starttag;
|
||||
if (tagtxtlen <= 0) tagtxtlen = 0;
|
||||
if ((starttag < curlocater) && (curlocater < endtag)) break;
|
||||
if ((endtag != NULL) && ((endtag + 1) != NULL))
|
||||
if ((endtag) && ((endtag + 1)))
|
||||
srcstring = endtag + 1;
|
||||
else
|
||||
break;
|
||||
|
@ -229,20 +229,20 @@ _strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int
|
|||
eina_strbuf_append_n(repbuf, starttag, tagtxtlen);
|
||||
srcstring = eina_strbuf_string_get(repbuf);
|
||||
curlocater = strstr(srcstring, key);
|
||||
if (curlocater != NULL)
|
||||
if (curlocater)
|
||||
{
|
||||
replocater = curlocater + strlen(key) + 1;
|
||||
while ((*replocater != '=') && (replocater != NULL))
|
||||
while ((*replocater != '=') && (replocater))
|
||||
replocater++;
|
||||
if (replocater != NULL)
|
||||
if (replocater)
|
||||
{
|
||||
replocater++;
|
||||
while ((*replocater != ' ') &&
|
||||
(*replocater != '>') &&
|
||||
(replocater == NULL))
|
||||
(!replocater))
|
||||
replocater++;
|
||||
}
|
||||
if (replocater != NULL)
|
||||
if (replocater)
|
||||
{
|
||||
replocater--;
|
||||
eina_strbuf_append_n(diffbuf, curlocater,
|
||||
|
@ -259,8 +259,8 @@ _strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int
|
|||
insertflag = 1;
|
||||
}
|
||||
|
||||
if (repbuf == NULL) repbuf = eina_strbuf_new();
|
||||
if (diffbuf == NULL) diffbuf = eina_strbuf_new();
|
||||
if (!repbuf) repbuf = eina_strbuf_new();
|
||||
if (!diffbuf) diffbuf = eina_strbuf_new();
|
||||
|
||||
if (insertflag)
|
||||
{
|
||||
|
@ -351,7 +351,7 @@ _ellipsis_label_to_width(Evas_Object *obj)
|
|||
|
||||
if (_get_value_in_key_string(wd->label, "font_size", &kvalue) == 0)
|
||||
{
|
||||
if (kvalue != NULL) cur_fontsize = atoi((char *)kvalue);
|
||||
if (kvalue) cur_fontsize = atoi((char *)kvalue);
|
||||
}
|
||||
|
||||
txtbuf = eina_strbuf_new();
|
||||
|
@ -362,7 +362,7 @@ _ellipsis_label_to_width(Evas_Object *obj)
|
|||
if (cur_fontsize > minfontsize)
|
||||
{
|
||||
cur_fontsize--;
|
||||
if (fontbuf != NULL)
|
||||
if (fontbuf)
|
||||
{
|
||||
eina_strbuf_free(fontbuf);
|
||||
fontbuf = NULL;
|
||||
|
@ -376,7 +376,7 @@ _ellipsis_label_to_width(Evas_Object *obj)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (txtbuf != NULL)
|
||||
if (txtbuf)
|
||||
{
|
||||
eina_strbuf_free(txtbuf);
|
||||
txtbuf = NULL;
|
||||
|
|
|
@ -249,7 +249,7 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
|
|||
Elm_List_Item *it;
|
||||
|
||||
if (!wd) return;
|
||||
if (sub == NULL) abort();
|
||||
if (!sub) abort();
|
||||
if (sub == wd->scr)
|
||||
wd->scr = NULL;
|
||||
else
|
||||
|
|
|
@ -715,7 +715,7 @@ save_env(void)
|
|||
|
||||
oldenv = environ;
|
||||
|
||||
for (i = 0, size = 0; environ[i] != NULL; i++)
|
||||
for (i = 0, size = 0; environ[i]; i++)
|
||||
size += strlen(environ[i]) + 1;
|
||||
|
||||
p = malloc((i + 1) * sizeof(char *));
|
||||
|
@ -723,7 +723,7 @@ save_env(void)
|
|||
|
||||
environ = p;
|
||||
|
||||
for (i = 0; oldenv[i] != NULL; i++)
|
||||
for (i = 0; oldenv[i]; i++)
|
||||
environ[i] = strdup(oldenv[i]);
|
||||
environ[i] = NULL;
|
||||
}
|
||||
|
|
|
@ -130,12 +130,12 @@ _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void
|
|||
ecore_evas_callback_resize_set(win->ee, NULL);
|
||||
if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
|
||||
if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
|
||||
while (((child = evas_object_bottom_get(win->evas)) != NULL) &&
|
||||
while (((child = evas_object_bottom_get(win->evas))) &&
|
||||
(child != obj))
|
||||
{
|
||||
evas_object_del(child);
|
||||
}
|
||||
while (((child = evas_object_top_get(win->evas)) != NULL) &&
|
||||
while (((child = evas_object_top_get(win->evas))) &&
|
||||
(child != obj))
|
||||
{
|
||||
evas_object_del(child);
|
||||
|
|
Loading…
Reference in New Issue