Skip to content
Permalink
Browse files

e-object-check - this has been turned off since 2007 - back on.

  • Loading branch information...
rbtylee committed May 28, 2018
1 parent b59375c commit 5c866b140edbd307a03dbb4702bc73c60e58cc4f
Showing with 32 additions and 28 deletions.
  1. +1 −1 src/bin/e.h
  2. +1 −1 src/bin/e_eap_editor.c
  3. +11 −9 src/bin/e_gadcon.c
  4. +1 −1 src/bin/e_manager.c
  5. +7 −7 src/bin/e_object.h
  6. +3 −1 src/bin/e_shelf.c
  7. +8 −8 src/modules/winlist/e_winlist.c
@@ -17,8 +17,8 @@
# define USE_IPC
# if 0
# define OBJECT_PARANOIA_CHECK
# define OBJECT_CHECK
# endif
# define OBJECT_CHECK

# ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
@@ -251,7 +251,7 @@ _e_desktop_edit_free(E_Desktop_Edit *editor)
{
if (!editor) return;
E_OBJECT_CHECK(editor);
E_OBJECT_TYPE_CHECK(editor, E_EAP_EDIT_TYPE);
E_OBJECT_TYPE_CHECK(editor, E_DESKTOP_EDIT_TYPE);

IFFREE(editor->tmp_image_path);
E_FREE(editor);
@@ -560,8 +560,8 @@ e_gadcon_populate(E_Gadcon *gc)
Eina_List *l;
E_Config_Gadcon_Client *cf_gcc;

E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
E_OBJECT_CHECK_RETURN(gc, EINA_FALSE);
E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, EINA_FALSE);
e_gadcon_layout_freeze(gc->o_container);
EINA_LIST_FOREACH(gc->cf->clients, l, cf_gcc)
{
@@ -639,7 +639,9 @@ e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient)

E_OBJECT_CHECK(gc);
E_OBJECT_IF_NOT_TYPE(gc, E_GADCON_DUMMY_TYPE)
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
{
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
}
if (gc->orient == orient) return;
gc->orient = orient;
if (gc->dummy) return;
@@ -1491,8 +1493,8 @@ e_gadcon_client_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int *
{
int gx = 0, gy = 0;

E_OBJECT_CHECK(gcc);
E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
E_OBJECT_CHECK_RETURN(gcc, 0);
E_OBJECT_TYPE_CHECK_RETURN(gcc, E_GADCON_CLIENT_TYPE, 0);
if (!e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &gx, &gy, NULL, NULL))
return 0;
if (gcc->o_base) evas_object_geometry_get(gcc->o_base, x, y, w, h);
@@ -1504,8 +1506,8 @@ e_gadcon_client_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int *
EAPI int
e_gadcon_client_viewport_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int *h)
{
E_OBJECT_CHECK(gcc);
E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
E_OBJECT_CHECK_RETURN(gcc, 0);
E_OBJECT_TYPE_CHECK_RETURN(gcc, E_GADCON_CLIENT_TYPE, 0);

if (gcc->o_box) evas_object_geometry_get(gcc->o_base, x, y, w, h);
else if (gcc->o_base)
@@ -1706,8 +1708,8 @@ e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu_gadget
E_Menu_Item *mi;
char buf[256];

E_OBJECT_CHECK(gcc);
E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
E_OBJECT_CHECK_RETURN(gcc, NULL);
E_OBJECT_TYPE_CHECK_RETURN(gcc, E_GADCON_CLIENT_TYPE, NULL);

if (e_config->menu_gadcon_client_toplevel)
menu_main = menu_gadget;
@@ -539,7 +539,7 @@ e_manager_comp_set(E_Manager *man, E_Manager_Comp *comp)
EAPI Evas *
e_manager_comp_evas_get(E_Manager *man)
{
E_OBJECT_CHECK(man);
E_OBJECT_CHECK_RETURN(man, NULL);
E_OBJECT_TYPE_CHECK_RETURN(man, E_MANAGER_TYPE, NULL);
if (!man->comp) return NULL;
return man->comp->func.evas_get(man->comp->data, man);
@@ -28,20 +28,20 @@
# define E_OBJECT_CHECK_RETURN(x, ret) do {if (e_object_error(E_OBJECT(x))) return ret;} while (0)
# define E_OBJECT_TYPE_CHECK(x, tp) do {if ((E_OBJECT(x)->type) != (tp)) { fprintf(stderr, "Object type check failed in %s\n", __FUNCTION__); return;} } while (0)
# define E_OBJECT_TYPE_CHECK_RETURN(x, tp, ret) do {if ((E_OBJECT(x)->type) != tp) { fprintf(stderr, "Object type check failed in %s\n", __FUNCTION__); return ret;} } while (0)
# define E_OBJECT_IF_NOT_TYPE(x, tp) if (E_OBJECT(x)->type != (tp))
# define E_OBJECT_IF_NOT_TYPE(x, tp) if (E_OBJECT(x)->type != (tp))
#else
# ifdef OBJECT_CHECK
# define E_OBJECT_CHECK(x) do {if ((!E_OBJECT(x)) || (E_OBJECT(x)->magic != E_OBJECT_MAGIC)) return;} while (0)
# define E_OBJECT_CHECK_RETURN(x, ret) do {if ((!E_OBJECT(x)) || (E_OBJECT(x)->magic != E_OBJECT_MAGIC)) return ret;} while (0)
# define E_OBJECT_TYPE_CHECK(x, tp) do {if ((E_OBJECT(x)->type) != (tp)) { fprintf(stderr, "Object type check failed in %s\n", __FUNCTION__); return;} } while (0)
# define E_OBJECT_TYPE_CHECK_RETURN(x, tp, ret) do {if ((E_OBJECT(x)->type) != (tp)) { fprintf(stderr, "Object type check failed in %s\n", __FUNCTION__); return ret;} } while (0)
# define E_OBJECT_IF_NOT_TYPE(x, type) if (E_OBJECT(x)->type != (type))
# define E_OBJECT_CHECK(x) do {if ((!E_OBJECT(x)) || (E_OBJECT(x)->magic != (int)E_OBJECT_MAGIC)) return;} while (0)
# define E_OBJECT_CHECK_RETURN(x, ret) do {if ((!E_OBJECT(x)) || (E_OBJECT(x)->magic != (int)E_OBJECT_MAGIC)) return ret;} while (0)
# define E_OBJECT_TYPE_CHECK(x, tp) do {if ((E_OBJECT(x)->type) != (int)(tp)) { CRI("Object type check failed in %s", __FUNCTION__); return;} } while (0)
# define E_OBJECT_TYPE_CHECK_RETURN(x, tp, ret) do {if ((E_OBJECT(x)->type) != (int)(tp)) { CRI("Object type check failed in %s", __FUNCTION__); return ret;} } while (0)
# define E_OBJECT_IF_NOT_TYPE(x, tp) if (E_OBJECT(x)->type != (int)(tp))
# else
# define E_OBJECT_CHECK(x)
# define E_OBJECT_CHECK_RETURN(x, ret)
# define E_OBJECT_TYPE_CHECK(x, type)
# define E_OBJECT_TYPE_CHECK_RETURN(x, type, ret)
# define E_OBJECT_IF_NOT_TYPE(x, type)
# define E_OBJECT_IF_NOT_TYPE(x, type)
# endif
#endif

@@ -631,7 +631,9 @@ e_shelf_orient(E_Shelf *es, E_Gadcon_Orient orient)

E_OBJECT_CHECK(es);
E_OBJECT_IF_NOT_TYPE(es, E_SHELF_DUMMY_TYPE)
E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
{
E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
}

if (!es->dummy)
{
@@ -410,8 +410,8 @@ e_winlist_left(E_Zone *zone)

_bd_next = NULL;

E_OBJECT_CHECK_RETURN(zone, 0);
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);

bd_orig = e_border_focused_get();
if (!bd_orig) return;
@@ -532,8 +532,8 @@ e_winlist_down(E_Zone *zone)

_bd_next = NULL;

E_OBJECT_CHECK_RETURN(zone, 0);
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);

bd_orig = e_border_focused_get();
if (!bd_orig) return;
@@ -654,8 +654,8 @@ e_winlist_up(E_Zone *zone)

_bd_next = NULL;

E_OBJECT_CHECK_RETURN(zone, 0);
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);

bd_orig = e_border_focused_get();
if (!bd_orig) return;
@@ -776,8 +776,8 @@ e_winlist_right(E_Zone *zone)

_bd_next = NULL;

E_OBJECT_CHECK_RETURN(zone, 0);
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
E_OBJECT_CHECK(zone);
E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE);

bd_orig = e_border_focused_get();
if (!bd_orig) return;

1 comment on commit 5c866b1

@rbtylee

This comment has been minimized.

Copy link
Collaborator Author

rbtylee commented on 5c866b1 May 28, 2018

This is a backport and rather incredible it took so long to notice.

Moksha has 337 uses of E_OBJECT_CHECK and its variants as far as I can tell and I had been assuming they all worked as expected to check for types and null pointers.

Please sign in to comment.
You can’t perform that action at this time.