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 b2332d5946
commit 63f07459a0
28 changed files with 94 additions and 94 deletions

View File

@ -494,7 +494,7 @@ ACT_FN_GO(window_fullscreen_toggle, )
bd = (E_Border *)obj;
if (bd->fullscreen)
e_border_unfullscreen(bd);
else if (params == NULL || *params == '\0')
else if (!params || *params == '\0')
e_border_fullscreen(bd, e_config->fullscreen_policy);
else if (! strcmp(params, "resize"))
e_border_fullscreen(bd, E_FULLSCREEN_RESIZE);
@ -1009,7 +1009,7 @@ ACT_FN_GO(window_push, )
bd_list = e_container_border_list_first(bd->zone->container);
cur = e_container_border_list_next(bd_list);
while (cur != NULL)
while (cur)
{
if ((bd->desk == cur->desk) && (bd != cur) && (!cur->iconic))
{
@ -1092,7 +1092,7 @@ ACT_FN_GO(window_desk_move_by, )
to_x = dx + x;
to_y = dy + y;
while ((desk = e_desk_at_xy_get(bd->zone, to_x, to_y )) == NULL)
while (!(desk = e_desk_at_xy_get(bd->zone, to_x, to_y)))
{
/* here we are out of our desktop range */
while (to_x >= bd->zone->desk_x_count)
@ -3111,9 +3111,9 @@ e_action_predef_name_set(const char *act_grp, const char *act_name, const char *
if (!actd) return;
actd->act_name = eina_stringshare_add(act_name);
actd->act_cmd = act_cmd == NULL ? NULL : eina_stringshare_add(act_cmd);
actd->act_params = act_params == NULL ? NULL : eina_stringshare_add(act_params);
actd->param_example = param_example == NULL ? NULL : eina_stringshare_add(param_example);
actd->act_cmd = !act_cmd ? NULL : eina_stringshare_add(act_cmd);
actd->act_params = !act_params ? NULL : eina_stringshare_add(act_params);
actd->param_example = !param_example ? NULL : eina_stringshare_add(param_example);
actd->editable = editable;
actg->acts = eina_list_append(actg->acts, actd);

View File

@ -2154,7 +2154,7 @@ _eet_union_type_get(const void *data, Eina_Bool *unknow)
int i;
if (unknow) *unknow = EINA_FALSE;
for (i = 0; eet_mapping[i].name != NULL; ++i)
for (i = 0; eet_mapping[i].name; ++i)
if (*u == eet_mapping[i].u)
return eet_mapping[i].name;
@ -2170,7 +2170,7 @@ _eet_union_type_set(const char *type, void *data, Eina_Bool unknow)
if (unknow) return EINA_FALSE;
for (i = 0; eet_mapping[i].name != NULL; ++i)
for (i = 0; eet_mapping[i].name; ++i)
if (strcmp(eet_mapping[i].name, type) == 0)
{
*u = eet_mapping[i].u;

View File

@ -665,8 +665,8 @@ _e_desklock_check_auth(void)
{
#endif
if ((e_config->desklock_personal_passwd) &&
(!strcmp(edd->passwd == NULL ? "" : edd->passwd,
e_config->desklock_personal_passwd == NULL ? "" :
(!strcmp(!edd->passwd ? "" : edd->passwd,
!e_config->desklock_personal_passwd ? "" :
e_config->desklock_personal_passwd)))
{
/* password ok */

View File

@ -574,7 +574,7 @@ _dialog_scrolltext_create(Evas *evas, char *title, Ecore_Exe_Event_Data_Line *li
obj = e_widget_textblock_add(evas);
tlen = 0;
for (i = 0; lines[i].line != NULL; i++)
for (i = 0; lines[i].line; i++)
{
tlen += lines[i].size + 1;
/* When the program output is extraordinarily long, it can cause
@ -600,7 +600,7 @@ _dialog_scrolltext_create(Evas *evas, char *title, Ecore_Exe_Event_Data_Line *li
}
/* Append the warning about truncated output. */
if (lines[max_lines].line != NULL) strcat(text, trunc_note);
if (lines[max_lines].line) strcat(text, trunc_note);
e_widget_textblock_plain_set(obj, text);
}
@ -765,13 +765,13 @@ _dialog_save_cb(void *data __UNUSED__, void *data2)
if (read_length)
{
tlen = 0;
for (i = 0; cfdata->read->lines[i].line != NULL; i++)
for (i = 0; cfdata->read->lines[i].line; i++)
tlen += cfdata->read->lines[i].size + 2;
text = alloca(tlen + 1);
if (text)
{
text[0] = 0;
for (i = 0; cfdata->read->lines[i].line != NULL; i++)
for (i = 0; cfdata->read->lines[i].line; i++)
{
strcat(text, "\t");
strcat(text, cfdata->read->lines[i].line);
@ -794,13 +794,13 @@ _dialog_save_cb(void *data __UNUSED__, void *data2)
if (read_length)
{
tlen = 0;
for (i = 0; cfdata->error->lines[i].line != NULL; i++)
for (i = 0; cfdata->error->lines[i].line; i++)
tlen += cfdata->error->lines[i].size + 1;
text = alloca(tlen + 1);
if (text)
{
text[0] = 0;
for (i = 0; cfdata->error->lines[i].line != NULL; i++)
for (i = 0; cfdata->error->lines[i].line; i++)
{
strcat(text, "\t");
strcat(text, cfdata->error->lines[i].line);

View File

@ -1919,7 +1919,7 @@ _e_fm2_icon_thumb_edje_get(Evas *evas, const E_Fm2_Icon *ic, void (*cb) (void *d
else
itr = known_groups + 1;
for (; *itr != NULL; itr++)
for (; *itr; itr++)
if (edje_file_group_exists(buf, *itr))
break;
@ -9292,7 +9292,7 @@ _e_fm2_file_delete_delete_cb(void *obj)
static char *
_e_fm_string_append_char(char *str, size_t *size, size_t *len, char c)
{
if (str == NULL)
if (!str)
{
str = malloc(4096);
str[0] = '\x00';

View File

@ -1810,7 +1810,7 @@ static int _e_fm_slave_run(E_Fm_Op_Type type, const char *args, int id)
_e_fm_slaves = eina_list_append(_e_fm_slaves, slave);
return (slave->exe != NULL);
return (!!slave->exe);
}
static E_Fm_Slave *_e_fm_slave_get(int id)
@ -1910,7 +1910,7 @@ _e_fm_slave_error_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
Ecore_Exe_Event_Data *e = event;
E_Fm_Slave *slave;
if (e == NULL) return 1;
if (!e) return 1;
slave = ecore_exe_data_get(e->exe);

View File

@ -664,7 +664,7 @@ _e_fm_op_work_idler(void *data __UNUSED__)
{
if ((_e_fm_op_separator) &&
(_e_fm_op_work_queue == _e_fm_op_separator) &&
(_e_fm_op_scan_idler_p == NULL))
(!_e_fm_op_scan_idler_p))
{
/* You may want to look at the comment in _e_fm_op_scan_atom() about this separator thing. */
_e_fm_op_work_queue = eina_list_remove_list(_e_fm_op_work_queue, _e_fm_op_separator);
@ -672,7 +672,7 @@ _e_fm_op_work_idler(void *data __UNUSED__)
return ECORE_CALLBACK_RENEW;
}
if ((_e_fm_op_scan_idler_p == NULL) && (!_e_fm_op_work_error) &&
if ((!_e_fm_op_scan_idler_p) && (!_e_fm_op_work_error) &&
(!_e_fm_op_scan_error))
ecore_main_loop_quit();
@ -1212,14 +1212,14 @@ _e_fm_op_open_files(E_Fm_Op_Task *task)
if (!data->from)
{
data->from = fopen(task->src.name, "rb");
if (data->from == NULL)
if (!data->from)
_E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot open file '%s' for reading: %s.", task->src.name);
}
if (!data->to)
{
data->to = fopen(task->dst.name, "wb");
if (data->to == NULL)
if (!data->to)
_E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot open file '%s' for writing: %s.", task->dst.name);
}

View File

@ -156,7 +156,7 @@ e_font_available_hash_free(Eina_Hash *hash)
EAPI E_Font_Properties *
e_font_fontconfig_name_parse(const char *font)
{
if (font == NULL) return NULL;
if (!font) return NULL;
return _e_font_fontconfig_name_parse(NULL, NULL, font);
}
@ -190,7 +190,7 @@ _e_font_fontconfig_name_parse(Eina_Hash **font_hash, E_Font_Properties *efp, con
style = s1 + strlen(E_TOK_STYLE);
if (font_hash) efp = eina_hash_find(*font_hash, name);
if (efp == NULL)
if (!efp)
{
efp = calloc(1, sizeof(E_Font_Properties));
efp->name = eina_stringshare_add(name);
@ -220,7 +220,7 @@ _e_font_fontconfig_name_parse(Eina_Hash **font_hash, E_Font_Properties *efp, con
else
{
if (font_hash) efp = eina_hash_find(*font_hash, font);
if (efp == NULL)
if (!efp)
{
efp = calloc(1, sizeof(E_Font_Properties));
efp->name = eina_stringshare_add(font);
@ -279,8 +279,8 @@ e_font_fontconfig_name_get(const char *name, const char *style)
{
char buf[256];
if (name == NULL) return NULL;
if (style == NULL || style[0] == 0) return eina_stringshare_add(name);
if (!name) return NULL;
if (!style || style[0] == 0) return eina_stringshare_add(name);
snprintf(buf, 256, "%s"E_TOK_STYLE"%s", name, style);
return eina_stringshare_add(buf);
}

View File

@ -127,7 +127,7 @@ main(int argc, char **argv)
{
write_imc = calloc(sizeof(E_Input_Method_Config), 1);
write_imc->version = E_INTL_INPUT_METHOD_CONFIG_VERSION;
if (read_imc != NULL)
if (read_imc)
{
write_imc->e_im_name = read_imc->e_im_name;
write_imc->gtk_im_module = read_imc->gtk_im_module;
@ -137,17 +137,17 @@ main(int argc, char **argv)
write_imc->e_im_setup_exec = read_imc->e_im_setup_exec;
}
if (set_name != NULL)
if (set_name)
write_imc->e_im_name = set_name;
if (set_gtk_im_module != NULL)
if (set_gtk_im_module)
write_imc->gtk_im_module = set_gtk_im_module;
if (set_qt_im_module != NULL)
if (set_qt_im_module)
write_imc->qt_im_module = set_qt_im_module;
if (set_xmodifiers != NULL)
if (set_xmodifiers)
write_imc->xmodifiers = set_xmodifiers;
if (set_exe != NULL)
if (set_exe)
write_imc->e_im_exec = set_exe;
if (set_setup != NULL)
if (set_setup)
write_imc->e_im_setup_exec = set_setup;

View File

@ -236,7 +236,7 @@ _cftype_free(CFType *cft)
{
CFModule *cfm;
assert(cft->modules_hash == NULL); // must do it before calling this function
assert(!cft->modules_hash); // must do it before calling this function
EINA_LIST_FREE(cft->modules, cfm)
_module_free(cfm);

View File

@ -372,7 +372,7 @@ e_int_menus_menu_augmentation_add_sorted(const char *menu,
if (_e_int_menus_augmentation)
{
l = eina_hash_find(_e_int_menus_augmentation, menu);
old = (l != NULL);
old = (l);
}
else
{

View File

@ -18,8 +18,8 @@ static char *_e_intl_orig_gtk_im_module = NULL;
static const char *_e_intl_imc_personal_path = NULL;
static const char *_e_intl_imc_system_path = NULL;
#define E_EXE_STOP(EXE) if (EXE != NULL) { ecore_exe_terminate(EXE); ecore_exe_free(EXE); EXE = NULL; }
#define E_EXE_IS_VALID(EXE) (!((EXE == NULL) || (EXE[0] == 0)))
#define E_EXE_STOP(EXE) if (EXE) { ecore_exe_terminate(EXE); ecore_exe_free(EXE); EXE = NULL; }
#define E_EXE_IS_VALID(EXE) (!((!EXE) || (EXE[0] == 0)))
/* All locale parts */
#define E_INTL_LOC_ALL E_INTL_LOC_LANG | \
@ -209,14 +209,14 @@ e_intl_language_set(const char *lang)
char *locale_path;
locale_path = _e_intl_language_path_find(_e_intl_language_alias);
if (locale_path == NULL)
if (!locale_path)
{
E_Locale_Parts *locale_parts;
locale_parts = e_intl_locale_parts_get(_e_intl_language_alias);
/* If locale is C or some form of en don't report an error */
if ((locale_parts == NULL) &&
if ((!locale_parts) &&
(strcmp(_e_intl_language_alias, "C")))
{
fprintf(stderr,
@ -390,7 +390,7 @@ e_intl_input_method_list(void)
const char *
e_intl_imc_personal_path_get(void)
{
if (_e_intl_imc_personal_path == NULL)
if (!_e_intl_imc_personal_path)
{
char buf[4096];
@ -403,7 +403,7 @@ e_intl_imc_personal_path_get(void)
const char *
e_intl_imc_system_path_get(void)
{
if (_e_intl_imc_system_path == NULL)
if (!_e_intl_imc_system_path)
{
char buf[4096];
@ -469,7 +469,7 @@ _e_intl_language_path_find(char *language)
search_list = _e_intl_locale_search_order_get(language);
if (search_list == NULL) return NULL;
if (!search_list) return NULL;
directory = NULL;
found = 0;
@ -546,11 +546,11 @@ _e_intl_locale_alias_get(const char *language)
char *lower_language;
unsigned int i;
if ((language == NULL) || (!strncmp(language, "POSIX", strlen("POSIX"))))
if ((!language) || (!strncmp(language, "POSIX", strlen("POSIX"))))
return strdup("C");
alias_hash = _e_intl_locale_alias_hash_get();
if (alias_hash == NULL) /* No alias file available */
if (!alias_hash) /* No alias file available */
return strdup(language);
lower_language = malloc(strlen(language) + 1);
@ -755,7 +755,7 @@ e_intl_locale_parts_get(const char *locale)
EAPI void
e_intl_locale_parts_free(E_Locale_Parts *locale_parts)
{
if (locale_parts != NULL)
if (locale_parts)
{
if (locale_parts->lang) eina_stringshare_del(locale_parts->lang);
if (locale_parts->region) eina_stringshare_del(locale_parts->region);
@ -881,7 +881,7 @@ _e_intl_locale_validate(const char *locale)
locale_lr =
e_intl_locale_parts_combine(locale_parts,
E_INTL_LOC_LANG | E_INTL_LOC_REGION);
if (locale_lr == NULL)
if (!locale_lr)
{
/* Not valid locale, maybe its an alias */
locale_lr = strdup(locale);
@ -914,7 +914,7 @@ _e_intl_locale_validate(const char *locale)
(!strcmp(locale_lr, locale_lr_next)))
{
/* Matched lang/region part, now if CS matches */
if ((locale_parts->codeset == NULL) && (locale_parts_next->codeset == NULL))
if ((!locale_parts->codeset) && (!locale_parts_next->codeset))
{
/* Lang/Region parts match and no charsets,
* we have a match
@ -995,7 +995,7 @@ _e_intl_locale_search_order_get(const char *locale)
int mask;
locale_parts = e_intl_locale_parts_get(locale);
if (locale_parts == NULL) return NULL;
if (!locale_parts) return NULL;
search_list = NULL;
for (mask = E_INTL_LOC_ALL; mask >= E_INTL_LOC_LANG; mask--)
@ -1022,7 +1022,7 @@ _e_intl_imc_dir_scan(const char *dir)
EINA_LIST_FREE(files, file)
{
if (strstr(file, ".imc") != NULL)
if (strstr(file, ".imc"))
{
char buf[PATH_MAX];

View File

@ -60,7 +60,7 @@ e_intl_input_method_config_write(Eet_File *imc_file, E_Input_Method_Config *imc)
EAPI void
e_intl_input_method_config_free(E_Input_Method_Config *imc)
{
if (imc != NULL)
if (imc)
{
if (imc->e_im_name) eina_stringshare_del(imc->e_im_name);
if (imc->gtk_im_module) eina_stringshare_del(imc->gtk_im_module);

View File

@ -347,7 +347,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
Eina_List *next;
int i;
if (cfdata->cur_enabled && cfdata->cur_font == NULL)
if (cfdata->cur_enabled && !cfdata->cur_font)
return 0;
for (i = 0; text_class_predefined_names[i].class_description; i++ )
@ -512,7 +512,7 @@ _basic_init_data_fill(E_Config_Dialog_Data *cfdata)
/* Check based on efd */
ob = cfdata->gui.enabled;
if (efd == NULL)
if (!efd)
e_widget_check_checked_set(ob, 0);
else if (!strcmp(efd->text_class, "default"))
e_widget_check_checked_set(ob, 0);
@ -1010,7 +1010,7 @@ _font_list_load(E_Config_Dialog_Data *cfdata, const char *cur_font)
e_widget_ilist_freeze(ob);
/* Load Hash a single time */
if (cfdata->font_hash == NULL)
if (!cfdata->font_hash)
{
Eina_List *fonts;

View File

@ -645,7 +645,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
/* First check if the LANGUAGE exists in there already */
lang_node = eina_hash_find(cfdata->locale_hash, locale_parts->lang);
if (lang_node == NULL)
if (!lang_node)
{
Eina_List *next;
int i;
@ -695,7 +695,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
{
region_node = eina_hash_find(lang_node->region_hash, locale_parts->region);
if (region_node == NULL)
if (!region_node)
{
int i;
@ -728,7 +728,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
const char * cs_trans;
cs_trans = _intl_charset_upper_get(locale_parts->codeset);
if (cs_trans == NULL)
if (!cs_trans)
cs = eina_stringshare_add(locale_parts->codeset);
else
cs = eina_stringshare_add(cs_trans);
@ -977,7 +977,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
cfdata->gui.lang_list = ob;
/* If lang_list already loaded just use it */
if (cfdata->lang_list == NULL)
if (!cfdata->lang_list)
eina_hash_foreach(cfdata->locale_hash, _lang_hash_cb, cfdata);
if (cfdata->lang_list)
@ -1284,7 +1284,7 @@ _intl_current_locale_setup(E_Config_Dialog_Data *cfdata)
const char *cs_trans;
cs_trans = _intl_charset_upper_get(locale_parts->codeset);
if (cs_trans == NULL)
if (!cs_trans)
cfdata->cur_cs = eina_stringshare_add(locale_parts->codeset);
else
cfdata->cur_cs = eina_stringshare_add(cs_trans);

View File

@ -139,8 +139,8 @@ _fill_data(E_Config_Dialog_Data *cfdata)
eb2->button = eb->button;
eb2->modifiers = eb->modifiers;
eb2->any_mod = eb->any_mod;
eb2->action = eb->action == NULL ? NULL : eina_stringshare_add(eb->action);
eb2->params = eb->params == NULL ? NULL : eina_stringshare_add(eb->params);
eb2->action = !eb->action ? NULL : eina_stringshare_add(eb->action);
eb2->params = !eb->params ? NULL : eina_stringshare_add(eb->params);
cfdata->binding.mouse = eina_list_append(cfdata->binding.mouse, eb2);
}
@ -153,8 +153,8 @@ _fill_data(E_Config_Dialog_Data *cfdata)
bw2->z = bw->z;
bw2->modifiers = bw->modifiers;
bw2->any_mod = bw->any_mod;
bw2->action = bw->action == NULL ? NULL : eina_stringshare_add(bw->action);
bw2->params = bw->params == NULL ? NULL : eina_stringshare_add(bw->params);
bw2->action = !bw->action ? NULL : eina_stringshare_add(bw->action);
bw2->params = !bw->params ? NULL : eina_stringshare_add(bw->params);
cfdata->binding.wheel = eina_list_append(cfdata->binding.wheel, bw2);
}
@ -226,8 +226,8 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
eb2->button = eb->button;
eb2->modifiers = eb->modifiers;
eb2->any_mod = eb->any_mod;
eb2->action = eb->action == NULL ? NULL : eina_stringshare_add(eb->action);
eb2->params = eb->params == NULL ? NULL : eina_stringshare_add(eb->params);
eb2->action = !eb->action ? NULL : eina_stringshare_add(eb->action);
eb2->params = !eb->params ? NULL : eina_stringshare_add(eb->params);
e_config->mouse_bindings = eina_list_append(e_config->mouse_bindings, eb2);
e_bindings_mouse_add(eb2->context, eb2->button, eb2->modifiers, eb2->any_mod,
@ -251,8 +251,8 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
bw2->z = bw->z;
bw2->modifiers = bw->modifiers;
bw2->any_mod = bw->any_mod;
bw2->action = bw->action == NULL ? NULL : eina_stringshare_add(bw->action);
bw2->params = bw->params == NULL ? NULL : eina_stringshare_add(bw->params);
bw2->action = !bw->action ? NULL : eina_stringshare_add(bw->action);
bw2->params = !bw->params ? NULL : eina_stringshare_add(bw->params);
e_config->wheel_bindings = eina_list_append(e_config->wheel_bindings, bw2);
e_bindings_wheel_add(bw2->context, bw2->direction, bw2->z, bw2->modifiers,

View File

@ -622,7 +622,7 @@ _preview_set(void *data)
int ret = 0;
int i;
for (i = 0; parts_list[i] != NULL; i++)
for (i = 0; parts_list[i]; i++)
if (strstr(parts_list[i], c_label)) break;
if (parts_list[i])
@ -725,9 +725,9 @@ _ilist_files_add(E_Config_Dialog_Data *cfdata, const char *header, const char *d
d = opendir(dir);
if (d)
{
while ((dentry = readdir(d)) != NULL)
while ((dentry = readdir(d)))
{
if (strstr(dentry->d_name,".edj") != NULL)
if (strstr(dentry->d_name, ".edj"))
{
snprintf(themename, sizeof(themename), "%s/%s",
dir, dentry->d_name);

View File

@ -197,7 +197,7 @@ e_connman_config_dialog_new(E_Container *con, E_Connman_Module_Context *ctxt)
E_Config_Dialog *dialog;
E_Config_Dialog_View *view;
EINA_SAFETY_ON_TRUE_RETURN_VAL(ctxt->conf_dialog != NULL, ctxt->conf_dialog);
EINA_SAFETY_ON_TRUE_RETURN_VAL(!!ctxt->conf_dialog, ctxt->conf_dialog);
view = E_NEW(E_Config_Dialog_View, 1);
if (!view)

View File

@ -593,7 +593,7 @@ _cpufreq_status_check_available(Status *s)
}
freq = strtok(NULL, " ");
}
while (freq != NULL);
while (freq);
s->frequencies = eina_list_sort(s->frequencies,
eina_list_count(s->frequencies),
@ -625,7 +625,7 @@ _cpufreq_status_check_available(Status *s)
s->governors = eina_list_append(s->governors, strdup(gov));
gov = strtok(NULL, " ");
}
while (gov != NULL);
while (gov);
s->governors =
eina_list_sort(s->governors, eina_list_count(s->governors),
@ -695,7 +695,7 @@ _cpufreq_status_check_current(Status *s)
buf[sizeof(buf) - 1] = 0;
fclose(f);
if ((s->cur_governor == NULL) || (strcmp(buf, s->cur_governor)))
if ((!s->cur_governor) || (strcmp(buf, s->cur_governor)))
{
ret = 1;
@ -758,7 +758,7 @@ _cpufreq_face_update_current(Instance *inst)
/* BSD crashes here without the if-condition
* since it has no governors (yet) */
if (cpufreq_config->status->cur_governor != NULL)
if (cpufreq_config->status->cur_governor)
{
governor_msg.str = cpufreq_config->status->cur_governor;
edje_object_message_send(inst->o_cpu, EDJE_MESSAGE_STRING, 4,
@ -810,7 +810,7 @@ _cpufreq_face_cb_set_governor(void *data __UNUSED__, Evas_Object *obj __UNUSED__
break;
}
}
if (next_governor != NULL) _cpufreq_set_governor(next_governor);
if (next_governor) _cpufreq_set_governor(next_governor);
}
static Eina_Bool

View File

@ -195,7 +195,7 @@ _e_fileman_dbus_daemon_new(void)
{NULL}
};
for (itr = desc; itr->method != NULL; itr++)
for (itr = desc; itr->method; itr++)
e_dbus_interface_method_add
(d->iface, itr->method, itr->signature, itr->ret_signature, itr->func);

View File

@ -262,7 +262,7 @@ _e_kbd_dict_open(E_Kbd_Dict *kd)
kd->file.size = st.st_size;
kd->file.dict = mmap(NULL, kd->file.size, PROT_READ, MAP_SHARED,
kd->file.fd, 0);
if ((kd->file.dict== MAP_FAILED) || (kd->file.dict == NULL))
if ((kd->file.dict== MAP_FAILED) || (!kd->file.dict))
{
close(kd->file.fd);
return 0;

View File

@ -271,7 +271,7 @@ _e_kbd_dict_open(E_Kbd_Dict *kd)
kd->file.size = st.st_size;
kd->file.dict = mmap(NULL, kd->file.size, PROT_READ, MAP_SHARED,
kd->file.fd, 0);
if ((kd->file.dict== MAP_FAILED) || (kd->file.dict == NULL))
if ((kd->file.dict== MAP_FAILED) || (!kd->file.dict))
{
close(kd->file.fd);
return 0;

View File

@ -200,7 +200,7 @@ _channels_info_new(E_Mixer_System *sys)
channels = e_mixer_system_get_channels(sys);
channels_infos = NULL;
for (l = channels; l != NULL; l = l->next)
for (l = channels; l; l = l->next)
{
struct channel_info *info;
@ -286,7 +286,7 @@ _populate_channels(E_Mixer_App_Dialog_Data *app)
}
}
for (l = app->channels_infos; l != NULL; l = l->next, i++)
for (l = app->channels_infos; l; l = l->next, i++)
{
struct channel_info *info = l->data;
@ -528,7 +528,7 @@ _find_card_by_name(E_Mixer_App_Dialog_Data *app, const char *card_name)
Eina_List *l;
int i;
for (i = 0, l = app->cards; l != NULL; i++, l = l->next)
for (i = 0, l = app->cards; l; i++, l = l->next)
if (strcmp(card_name, l->data) == 0)
return i;

View File

@ -22,7 +22,7 @@ _find_default_instance_index(E_Mixer_Module_Context *ctxt)
Eina_List *l;
int i;
for (i = 0, l = ctxt->instances; l != NULL; l = l->next, i++)
for (i = 0, l = ctxt->instances; l; l = l->next, i++)
if (l->data == ctxt->default_instance)
return i;
@ -92,7 +92,7 @@ _basic_create_general(E_Config_Dialog *dialog, Evas *evas, E_Config_Dialog_Data
e_widget_framelist_object_append(ui->frame, label);
ui->radio = e_widget_radio_group_new(&cfdata->default_instance);
for (i = 0, l = ctxt->instances; l != NULL; l = l->next, i++)
for (i = 0, l = ctxt->instances; l; l = l->next, i++)
{
E_Mixer_Instance *inst;
E_Mixer_Gadget_Config *conf;

View File

@ -710,7 +710,7 @@ _mixer_sys_setup(E_Mixer_Instance *inst)
inst->channel = e_mixer_system_get_channel_by_name(inst->sys,
conf->channel_name);
return inst->channel != NULL;
return !!inst->channel;
}
static int

View File

@ -303,7 +303,7 @@ e_mixer_system_get_channels(E_Mixer_System *self)
channels = NULL;
elem = snd_mixer_first_elem(self);
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
for (; elem; elem = snd_mixer_elem_next(elem))
{
if ((!snd_mixer_selem_is_active(elem)) ||
(!snd_mixer_selem_has_playback_volume(elem)))
@ -335,7 +335,7 @@ e_mixer_system_get_channels_names(E_Mixer_System *self)
snd_mixer_selem_id_alloca(&sid);
elem = snd_mixer_first_elem(self);
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
for (; elem; elem = snd_mixer_elem_next(elem))
{
const char *name;
if ((!snd_mixer_selem_is_active(elem)) ||
@ -372,7 +372,7 @@ e_mixer_system_get_default_channel_name(E_Mixer_System *self)
snd_mixer_selem_id_alloca(&sid);
elem = snd_mixer_first_elem(self);
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
for (; elem; elem = snd_mixer_elem_next(elem))
{
const char *name;
if ((!snd_mixer_selem_is_active(elem)) ||
@ -400,7 +400,7 @@ e_mixer_system_get_channel_by_name(E_Mixer_System *self, const char *name)
snd_mixer_selem_id_alloca(&sid);
elem = snd_mixer_first_elem(self);
for (; elem != NULL; elem = snd_mixer_elem_next(elem))
for (; elem; elem = snd_mixer_elem_next(elem))
{
const char *n;
if ((!snd_mixer_selem_is_active(elem)) ||

View File

@ -160,7 +160,7 @@ cb_desktop_bglist(E_DBus_Object *obj __UNUSED__, DBusMessage *msg)
{
DBusMessageIter sub;
if (bg == NULL || bg->file == NULL)
if (!bg || !bg->file)
{
continue;
}

View File

@ -334,7 +334,7 @@ temperature_face_update_config(Config_Face *inst)
"%s/%s/tempget %i \"%s\" %i",
e_module_dir_get(temperature_config->module), MODULE_ARCH,
inst->sensor_type,
(inst->sensor_name != NULL ? inst->sensor_name : "(null)"),
(inst->sensor_name ? inst->sensor_name : "(null)"),
inst->poll_interval);
inst->tempget_exe =
ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_READ |
@ -362,7 +362,7 @@ temperature_face_update_config(Config_Face *inst)
"%s/%s/tempget %i \"%s\" %i",
e_module_dir_get(temperature_config->module), MODULE_ARCH,
inst->sensor_type,
(inst->sensor_name != NULL ? inst->sensor_name : "(null)"),
(inst->sensor_name ? inst->sensor_name : "(null)"),
inst->poll_interval);
inst->tempget_exe =
ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_READ |