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
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/efreet@51487
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
* fields (fFuUdDnN). We only want to run the app once in this case. */
if (!file_added) break;
}
- while ((l = eina_list_next(l)) != NULL);
+ while ((l = eina_list_next(l)));
return execs;
error:
}
/* setup the default extension list */
- for (i = 0; default_exts[i] != NULL; i++)
+ for (i = 0; default_exts[i]; i++)
efreet_icon_extensions = eina_list_append(efreet_icon_extensions, eina_stringshare_add(default_exts[i]));
efreet_icon_themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_icon_theme_free));
double minimal_distance = INT_MAX;
unsigned int ret_size = 0;
- if (!theme || (theme->paths == NULL) || !icon_name || !size)
+ if (!theme || (!theme->paths) || !icon_name || !size)
return NULL;
icon = efreet_icon_cache_check(theme, icon_name, size);
/* only care if this is a directory or the theme name matches the
* given name */
snprintf(path, sizeof(path), "%s/%s", search_dir, dir->d_name);
- if (((theme_name != NULL) && (strcmp(theme_name, dir->d_name)))
+ if (((theme_name) && (strcmp(theme_name, dir->d_name)))
|| !ecore_file_is_dir(path))
continue;
goto next_line;
}
- if (section == NULL)
+ if (!section)
{
// INF("Invalid file (%s) (missing section)", file);
goto next_line;
* to handle it */
efreet_tag_menu = eina_stringshare_add(menu_cbs[0].key);
- for (i = 0; menu_cbs[i].key != NULL; i++)
+ for (i = 0; menu_cbs[i].key; i++)
{
eina_hash_del(efreet_menu_handle_cbs,
menu_cbs[i].key,
menu_cbs[i].key,
menu_cbs[i].cb);
}
- for (i = 0; filter_cbs[i].key != NULL; i++)
+ for (i = 0; filter_cbs[i].key; i++)
{
eina_hash_del(efreet_menu_filter_cbs,
filter_cbs[i].key,
filter_cbs[i].key,
filter_cbs[i].cb);
}
- for (i = 0; move_cbs[i].key != NULL; i++)
+ for (i = 0; move_cbs[i].key; i++)
{
eina_hash_del(efreet_menu_move_cbs,
move_cbs[i].key,
move_cbs[i].key,
move_cbs[i].cb);
}
- for (i = 0; layout_cbs[i].key != NULL; i++)
+ for (i = 0; layout_cbs[i].key; i++)
{
eina_hash_del(efreet_menu_layout_cbs,
layout_cbs[i].key,
for (k = 0; k < LOOPS; k++)
{
- for (i = 0; icons[i] != NULL; i++)
+ for (i = 0; icons[i]; i++)
{
path = efreet_icon_path_find(THEME, icons[i], SIZE);
// printf("%s: %s\n", icons[i], (path ? path : "NOT FOUND"));
char *def_vals[] = {PACKAGE_DATA_DIR, "/usr/share", "/usr/local/share", NULL};
dirs[0] = '\0';
- for (i = 0; vals[i] != NULL; i++)
+ for (i = 0; vals[i]; i++)
{
if (i > 0) strcat(dirs, ":");
strcat(dirs, vals[i]);
tmp = efreet_data_dirs_get();
EINA_LIST_FOREACH(tmp, l, val)
{
- if (vals[i] == NULL)
+ if (!vals[i])
{
printf("efreet_data_dirs_get() returned more values then it "
"should have given %s as input\n", dirs);
EINA_LIST_FOREACH(tmp, l, val)
{
- if (def_vals[i] == NULL)
+ if (!def_vals[i])
{
printf("efreet_data_dirs_get() returned more values then it "
"should have given %s as input\n", dirs);
dirs[0] = '\0';
- for (i = 0; vals[i] != NULL; i++)
+ for (i = 0; vals[i]; i++)
{
if (i > 0) strcat(dirs, ":");
strcat(dirs, vals[i]);
tmp = efreet_config_dirs_get();
EINA_LIST_FOREACH(tmp, l, val)
{
- if (vals[i] == NULL)
+ if (!vals[i])
{
printf("efreet_config_dirs_get() returned more values then it "
"should have given %s as input\n", dirs);
tmp = efreet_config_dirs_get();
EINA_LIST_FOREACH(tmp, l, val)
{
- if (def_vals[i] == NULL)
+ if (!def_vals[i])
{
printf("efreet_config_dirs_get() returned more values then it "
"should have given %s as input\n", dirs);
themes = eina_list_remove_list(themes, themes);
double start = ecore_time_get();
- for (i = 0; system_icons[i] != NULL; i++)
+ for (i = 0; system_icons[i]; i++)
{
char *path, *s;
eina_hash_free(icon_hash);
start = ecore_time_get();
- for (i = 0; system_icons[i] != NULL; i++)
+ for (i = 0; system_icons[i]; i++)
{
char *path, *s;
putenv("LC_MESSAGES=");
putenv("LANG=");
- for (i = 0; langs[i].lc_message != NULL; i++)
+ for (i = 0; langs[i].lc_message; i++)
{
const char *tmp;
return 1;
}
- for (i = 0; files[i].file != NULL; ++i)
+ for (i = 0; files[i].file; ++i)
{
mime = efreet_mime_type_get(files[i].file);
if (!mime)
itr = etc;
fputs("Available Test Cases:\n", stderr);
- for (; itr->test_case != NULL; itr++)
+ for (; itr->test_case; itr++)
fprintf(stderr, "\t%s\n", itr->test_case);
}
s = suite_create("Efreet");
- for (i = 0; etc[i].test_case != NULL; ++i)
+ for (i = 0; etc[i].test_case; ++i)
{
if (!_use_test(argc, argv, etc[i].test_case)) continue;
tc = tcase_create(etc[i].test_case);
if ((!strcmp(argv[i], "-h")) ||
(!strcmp(argv[i], "--help")))
{
- for (i = 0; tests[i].name != NULL; i++)
+ for (i = 0; tests[i].name; i++)
{
printf("%s\n", tests[i].name);
}
}
environment_store();
- for (i = 0; tests[i].name != NULL; i++)
+ for (i = 0; tests[i].name; i++)
{
int ret;
double start;