Make setter functions "edje_edit_script..." return Eina_Bool.
authorm.biliavskyi <m.biliavskyi@samsung.com>
Sat, 2 Nov 2013 12:26:18 +0000 (21:26 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sat, 2 Nov 2013 12:26:18 +0000 (21:26 +0900)
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

src/lib/edje/Edje_Edit.h
src/lib/edje/edje_edit.c

index 917dd79..23611da 100644 (file)
@@ -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
index 038414d..be6972d 100644 (file)
@@ -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