From: m.biliavskyi Date: Sat, 2 Nov 2013 12:26:18 +0000 (+0900) Subject: Make setter functions "edje_edit_script..." return Eina_Bool. X-Git-Tag: v1.8.0-alpha1~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3ce7c9b287e7ce643131207a31740f87e452ecc;p=platform%2Fupstream%2Fefl.git Make setter functions "edje_edit_script..." return Eina_Bool. Summary: Make the following function return Eina_Bool so the caller can detect errors : List of updated functions: edje_edit_script_set edje_edit_script_program_set Reviewers: cedric, seoz, raster Reviewed By: raster CC: reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D307 --- diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 917dd79..23611da 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -3744,8 +3744,10 @@ EAPI char *edje_edit_script_get(Evas_Object *obj); * * @param obj The object being edited * @param code The Embryo source + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. */ -EAPI void edje_edit_script_set(Evas_Object *obj, const char *code); +EAPI Eina_Bool edje_edit_script_set(Evas_Object *obj, const char *code); /** * Get the Embryo script for the given program. @@ -3775,8 +3777,10 @@ EAPI char *edje_edit_script_program_get(Evas_Object *obj, const char *prog); * @param obj The object being edited * @param prog The program name. * @param code The Embryo source + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. */ -EAPI void edje_edit_script_program_set(Evas_Object *obj, const char *prog, const char *code); +EAPI Eina_Bool edje_edit_script_program_set(Evas_Object *obj, const char *prog, const char *code); /** * Compile the Embryo script for the given object diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 038414d..be6972d 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -5746,10 +5746,10 @@ edje_edit_script_get(Evas_Object *obj) return strdup(eed->embryo_source); } -EAPI void +EAPI Eina_Bool edje_edit_script_set(Evas_Object *obj, const char *code) { - GET_EED_OR_RETURN(); + GET_EED_OR_RETURN(EINA_FALSE); free(eed->embryo_source); free(eed->embryo_processed); @@ -5763,6 +5763,7 @@ edje_edit_script_set(Evas_Object *obj, const char *code) eed->embryo_source_dirty = EINA_TRUE; _edje_edit_flag_script_dirty(eed, EINA_FALSE); + return EINA_TRUE; } EAPI char * @@ -5776,27 +5777,27 @@ edje_edit_script_program_get(Evas_Object *obj, const char *prog) if (epr->action != EDJE_ACTION_TYPE_SCRIPT) return NULL; - ps = eina_hash_find(eed->program_scripts, prog); + ps = eina_hash_find(eed->program_scripts, &epr->id); if (!ps) /* mmm? it should be there, even if empty */ return NULL; return ps->code ? strdup(ps->code) : NULL; } -EAPI void +EAPI Eina_Bool edje_edit_script_program_set(Evas_Object *obj, const char *prog, const char *code) { Program_Script *ps; - GET_EED_OR_RETURN(); - GET_EPR_OR_RETURN(); + GET_EED_OR_RETURN(EINA_FALSE); + GET_EPR_OR_RETURN(EINA_FALSE); if (epr->action != EDJE_ACTION_TYPE_SCRIPT) - return; + return EINA_FALSE; - ps = eina_hash_find(eed->program_scripts, prog); + ps = eina_hash_find(eed->program_scripts, &epr->id); if (!ps) /* ???? how so? */ - return; + return EINA_FALSE; free(ps->code); free(ps->processed); @@ -5809,6 +5810,7 @@ edje_edit_script_program_set(Evas_Object *obj, const char *prog, const char *cod ps->dirty = EINA_TRUE; _edje_edit_flag_script_dirty(eed, EINA_FALSE); + return EINA_TRUE; } static int