hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=fccce0894722dd5e08c42650123601bf62da8e16

commit fccce0894722dd5e08c42650123601bf62da8e16
Author: Cedric BAIL <[email protected]>
Date:   Fri Nov 16 12:09:48 2018 +0900

    eo: make efl_replace work with a const pointer like efl_ref/unref do.
    
    Summary: This is done to keep consistency with all the reference counting 
functions in Eo.
    
    Reviewers: Hermet, smohanty
    
    Reviewed By: Hermet
    
    Subscribers: #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D7274
---
 src/lib/eo/Eo.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 05c7cc5286..19af94db41 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -2076,13 +2076,15 @@ EAPI int efl_callbacks_cmp(const 
Efl_Callback_Array_Item *a, const Efl_Callback_
  * @see efl_unref()
  */
 static inline Eina_Bool
-efl_replace(Eo **storage, Eo *new_obj)
+efl_replace(Eo **storage, const Eo *new_obj)
 {
+   Eo *tmp = NULL;
+
    EINA_SAFETY_ON_NULL_RETURN_VAL(storage, EINA_FALSE);
    if (*storage == new_obj) return EINA_FALSE;
-   if (new_obj) efl_ref(new_obj);
+   if (new_obj) tmp = efl_ref(new_obj);
    if (*storage) efl_unref(*storage);
-   *storage = new_obj;
+   *storage = tmp;
    return EINA_TRUE;
 }
 

-- 


Reply via email to