Add a null reference that doesn't call malloc.

This commit is contained in:
2018-04-06 23:53:40 -07:00
parent 60d22c2511
commit dabab1e870
2 changed files with 19 additions and 0 deletions

View File

@@ -57,6 +57,12 @@ typedef struct libab_ref_count_s libab_ref_count;
* @return the result of the construction of the reference.
*/
libab_result libab_ref_new(libab_ref* ref, void* data, void (*free_func)(void* data));
/**
* Creates a reference to NULL. This does
* not require a memory allocation.
* @param ref the reference to initialize with null.
*/
void libab_ref_null(libab_ref* ref);
/**
* Turns the given reference into a weak reference,
* making it not keep the data allocated.