]> git.lizzy.rs Git - dragonstd.git/commitdiff
Add refcount_obj
authorElias Fleckenstein <eliasfleckenstein@web.de>
Sun, 3 Apr 2022 20:13:18 +0000 (22:13 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Sun, 3 Apr 2022 20:13:18 +0000 (22:13 +0200)
refcount.c
refcount.h

index f7a43ac623343ceece19054b3cd8b1ba9feb3f92..e0b354cfcf571e8f556c085ccf05b573ec5111ae 100644 (file)
@@ -25,7 +25,7 @@ void *refcount_inc(void *refcount)
 
 void *refcount_grb(void *refcount)
 {
-       return ((Refcount *) refcount_inc(refcount))->obj;
+       return refcount_obj(refcount_inc(refcount));
 }
 
 void *refcount_drp(void *refcount)
@@ -41,3 +41,8 @@ void *refcount_drp(void *refcount)
 
        return rc->obj;
 }
+
+void *refcount_obj(void *refcount)
+{
+       return ((Refcount *) refcount)->obj;
+}
index 32904f581c92791d506ee3eef258d10d682044dd..12e99d320499b00afc94c55163791de386b7225e 100644 (file)
@@ -72,4 +72,12 @@ void *refcount_drp(void *refcount);
                otherwise.
 */
 
+void *refcount_obj(void *refcount)
+/*
+       [Thread Safe]
+       Return referenced object.
+       This actually takes a Refcount * as argument, however void * is used to make it more
+               convenient to use the function as callback.
+*/
+
 #endif // _DRAGONSTD_REFCOUNT_H_