eo datarefcount - only use in debug mode
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 18 May 2016 14:02:09 +0000 (23:02 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 18 May 2016 14:11:00 +0000 (23:11 +0900)
src/lib/eo/eo.c
src/lib/eo/eo_private.h

index c8039f4..e11ef13 100644 (file)
@@ -1466,8 +1466,8 @@ _eo_data_xref_internal(const char *file, int line, _Eo_Object *obj, const _Eo_Cl
         data = _eo_data_scope_safe_get(obj, klass);
         if (data == NULL) return NULL;
      }
-   (obj->datarefcount)++;
 #ifdef EO_DEBUG
+   (obj->datarefcount)++;
    Eo_Xref_Node *xref = calloc(1, sizeof(*xref));
    xref->ref_obj = _eo_obj_id_get(ref_obj);
    xref->file = file;
@@ -1494,8 +1494,10 @@ _eo_data_xunref_internal(_Eo_Object *obj, void *data, const _Eo_Object *ref_obj)
         ERR("Data %p is not in the data range of the object %p (%s).", data, (Eo *)obj->headr.id, obj->klass->desc->name);
      }
 #else
+   (void) obj;
    (void) data;
 #endif
+#ifdef EO_DEBUG
    if (obj->datarefcount == 0)
      {
         ERR("Data for object %zx (%s) is already not referenced.", (size_t)_eo_obj_id_get(obj), obj->klass->desc->name);
@@ -1504,7 +1506,6 @@ _eo_data_xunref_internal(_Eo_Object *obj, void *data, const _Eo_Object *ref_obj)
      {
         (obj->datarefcount)--;
      }
-#ifdef EO_DEBUG
    Eo_Xref_Node *xref = NULL;
    EINA_INLIST_FOREACH(obj->data_xrefs, xref)
      {
index e448bbd..a05bdf6 100644 (file)
@@ -99,7 +99,9 @@ struct _Eo_Object
      Eo_Del_Intercept del_intercept;
 
      short refcount;
+#ifdef EO_DEBUG
      short datarefcount;
+#endif
 
      Eina_Bool condtor_done:1;
      Eina_Bool finalized:1;