Eobj: Make eobj_weak_ref_add return the obejct being reffed.
authorTom Hacohen <tom@stosb.com>
Mon, 23 Apr 2012 12:32:36 +0000 (12:32 +0000)
committerTom Hacohen <tom@stosb.com>
Mon, 23 Apr 2012 12:32:36 +0000 (12:32 +0000)
Suggested by vtorri.

SVN revision: 70418

legacy/eobj/lib/Eobj.h
legacy/eobj/lib/eobj.c

index 429a89e..b52e160 100644 (file)
@@ -545,8 +545,9 @@ EAPI void eobj_del(Eobj *obj);
  * @brief Create a new weak reference to obj.
  * @param obj The object being referenced.
  * @param wref The pointer to use for the weak ref.
+ * @return The object being referenced (obj).
  */
-EAPI void eobj_weak_ref_add(const Eobj *obj, Eobj **wref);
+EAPI Eobj *eobj_weak_ref_add(const Eobj *obj, Eobj **wref);
 
 /**
  * @brief Free the weak reference passed.
index f60824e..2810070 100644 (file)
@@ -1089,14 +1089,16 @@ _eobj_weak_ref_cb(void *data, Eobj *obj EINA_UNUSED, const Eobj_Event_Descriptio
    return EOBJ_CALLBACK_CONTINUE;
 }
 
-EAPI void
+EAPI Eobj *
 eobj_weak_ref_add(const Eobj *_obj, Eobj **wref)
 {
    Eobj *obj = (Eobj *) _obj;
-   EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC);
+   EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, obj);
 
    *wref = obj;
    eobj_event_callback_add(obj, EOBJ_EV_DEL, _eobj_weak_ref_cb, wref);
+
+   return obj;
 }
 
 EAPI void