summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-29 19:42:05 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-29 20:55:50 +0900
commit0dd9e02df24435a13a505232be0db5a5eb07d1f4 (patch)
tree811a8ceceb9bbc201f416e226cb3ea893c485fa8
parent3059859e28d27919e7a51fa1301f59bd983465c4 (diff)
downloadefl-0dd9e02df24435a13a505232be0db5a5eb07d1f4.tar.gz
Eo: Add internal function call on pointer errors
Useful for GDB: break on this function when things go wrong. Similar to eina_safety. I guess we could set some Eina_Error and maybe even have error callbacks for easier application debugging. Later.
-rw-r--r--src/lib/eo/eo_ptr_indirection.c6
-rw-r--r--src/lib/eo/eo_ptr_indirection.h13
2 files changed, 15 insertions, 4 deletions
diff --git a/src/lib/eo/eo_ptr_indirection.c b/src/lib/eo/eo_ptr_indirection.c
index ee559014f3..687ec8a8a1 100644
--- a/src/lib/eo/eo_ptr_indirection.c
+++ b/src/lib/eo/eo_ptr_indirection.c
@@ -15,3 +15,9 @@ _Eo_Ids_Table *_empty_table = NULL;
/* Next generation to use when assigning a new entry to a Eo pointer */
Generation_Counter _eo_generation_counter = 0;
+
+void
+_eo_pointer_error(const char *msg)
+{
+ ERR("%s", msg);
+}
diff --git a/src/lib/eo/eo_ptr_indirection.h b/src/lib/eo/eo_ptr_indirection.h
index e831a4a204..458d2a01c5 100644
--- a/src/lib/eo/eo_ptr_indirection.h
+++ b/src/lib/eo/eo_ptr_indirection.h
@@ -10,13 +10,18 @@
#ifdef HAVE_EO_ID
+void _eo_pointer_error(const char *msg);
+
+#define _EO_POINTER_ERR(fmt, ptr) \
+ do { char buf[256]; sprintf(buf, fmt, ptr); _eo_pointer_error(buf); } while (0)
+
#define EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, ret) \
_Eo_Object *obj; \
do { \
if (!obj_id) return ret; \
obj = _eo_obj_pointer_get((Eo_Id)obj_id); \
if (!obj) { \
- ERR("Obj (%p) is an invalid ref.", obj_id); \
+ _EO_POINTER_ERR("Obj (%p) is an invalid ref.", obj_id); \
return ret; \
} \
} while (0)
@@ -27,7 +32,7 @@
if (!obj_id) return; \
obj = _eo_obj_pointer_get((Eo_Id)obj_id); \
if (!obj) { \
- ERR("Obj (%p) is an invalid ref.", obj_id); \
+ _EO_POINTER_ERR("Obj (%p) is an invalid ref.", obj_id); \
return; \
} \
} while (0)
@@ -38,7 +43,7 @@
if (!klass_id) return ret; \
klass = _eo_class_pointer_get(klass_id); \
if (!klass) { \
- ERR("Klass (%p) is an invalid ref.", klass_id); \
+ _EO_POINTER_ERR("Klass (%p) is an invalid ref.", klass_id); \
return ret; \
} \
} while (0)
@@ -49,7 +54,7 @@
if (!klass_id) return; \
klass = _eo_class_pointer_get(klass_id); \
if (!klass) { \
- ERR("Klass (%p) is an invalid ref.", klass_id); \
+ _EO_POINTER_ERR("Klass (%p) is an invalid ref.", klass_id); \
return; \
} \
} while (0)