From 50f87c6bcb36f0ca5781c487235a2d972e32301c 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/bin/gettext.h | 4 ++-- src/bin/view.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/gettext.h b/src/bin/gettext.h index 597b5b0..f9a560c 100644 --- a/src/bin/gettext.h +++ b/src/bin/gettext.h @@ -202,7 +202,7 @@ dcpgettext_expr (const char *domain, (msgctxt_len + msgid_len <= sizeof (buf) ? buf : (char *) malloc (msgctxt_len + msgid_len)); - if (msg_ctxt_id != NULL) + if (msg_ctxt_id) #endif { memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); @@ -248,7 +248,7 @@ dcnpgettext_expr (const char *domain, (msgctxt_len + msgid_len <= sizeof (buf) ? buf : (char *) malloc (msgctxt_len + msgid_len)); - if (msg_ctxt_id != NULL) + if (msg_ctxt_id) #endif { memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); diff --git a/src/bin/view.c b/src/bin/view.c index 904667b..4e095a9 100644 --- a/src/bin/view.c +++ b/src/bin/view.c @@ -1304,8 +1304,8 @@ _bt_close(void *data, Evas_Object *obj, void *event_info) static Eina_Bool _run_dialog(Evas_Object *parent, enum dialog_type type, const char *message, const char *default_entry_value, char **entry_value) { - EINA_SAFETY_ON_TRUE_RETURN_VAL((type != DIALOG_PROMPT) && (default_entry_value != NULL), EINA_FALSE); - EINA_SAFETY_ON_TRUE_RETURN_VAL((type != DIALOG_PROMPT) && (entry_value != NULL), EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL((type != DIALOG_PROMPT) && (!!default_entry_value), EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL((type != DIALOG_PROMPT) && (!!entry_value), EINA_FALSE); struct _dialog_data *dialog_data = calloc(1, sizeof(*dialog_data)); Eina_Bool response = EINA_FALSE; @@ -1464,7 +1464,7 @@ static void _view_smart_window_close(Ewk_View_Smart_Data *esd) { View_Smart_Data *sd = (View_Smart_Data *)esd; - EINA_SAFETY_ON_TRUE_RETURN(sd->idler_close_window != NULL); + EINA_SAFETY_ON_TRUE_RETURN(!!sd->idler_close_window); sd->idler_close_window = ecore_idler_add(_window_close_delayed, sd); }