Switch values to having their data refcounted separately.

This allows for values to be "cast" and have a different type, while
still referencing the same data.
This commit is contained in:
2018-05-14 17:41:41 -07:00
parent 3e8c814215
commit cf3136a237
5 changed files with 72 additions and 20 deletions

View File

@@ -80,7 +80,15 @@ libab_result libab_create_table(libab_ref* into, libab_ref* parent);
* @param type the type to give the value.
* @return the result of necessary allocations.
*/
libab_result libab_create_value(libab_ref* into, void* data, libab_ref* type);
libab_result libab_create_value_ref(libab_ref* into, libab_ref* data, libab_ref* type);
/**
* Allocates a new reference counted value with the given type and data.
* @param into the reference to store the allocated data into.
* @param data the type-specific data this value holds.
* @param type the type to give the value.
* @return the result of necessary allocations.
*/
libab_result libab_create_value_raw(libab_ref* into, void* data, libab_ref* type);
/**
* Creates a function list object, storing it in to the given reference.
* @param into the reference to store into.