File tree Expand file tree Collapse file tree 4 files changed +125
-70
lines changed Expand file tree Collapse file tree 4 files changed +125
-70
lines changed Original file line number Diff line number Diff line change @@ -305,6 +305,44 @@ METACALL_API size_t metacall_value_count(void * v);
305305*/
306306METACALL_API enum metacall_value_id metacall_value_id (void * v );
307307
308+ /**
309+ * @brief
310+ * Returns the owner of the value, useful for lifecycles
311+ *
312+ * @param[in] v
313+ * Reference to the value
314+ *
315+ * @return
316+ * Pointer to the owner of the value,
317+ * null means the value is not owned by anybody
318+ */
319+ METACALL_API void * metacall_value_owner (void * v );
320+
321+ /**
322+ * @brief
323+ * Set up the value ownership, overwrites the previous owner
324+ *
325+ * @param[in] v
326+ * Reference to the value
327+ *
328+ * @param[in] owner
329+ * Reference to the new owner
330+ */
331+ METACALL_API void metacall_value_own (void * v , void * owner );
332+
333+ /**
334+ * @brief
335+ * Deep copies the value @v, the result copy resets
336+ * the reference counter and ownership
337+ *
338+ * @param[in] v
339+ * Reference to the value to be copied
340+ *
341+ * @return
342+ * Copy of the value @v on success, null otherwhise
343+ */
344+ METACALL_API void * metacall_value_copy (void * v );
345+
308346/**
309347* @brief
310348* Convert value @v to boolean
Original file line number Diff line number Diff line change @@ -179,6 +179,21 @@ enum metacall_value_id metacall_value_id(void * v)
179179 return METACALL_INVALID ;
180180}
181181
182+ void * metacall_value_owner (value v )
183+ {
184+ return value_owner (v );
185+ }
186+
187+ void metacall_value_own (value v , void * owner )
188+ {
189+ value_own (v , owner );
190+ }
191+
192+ void * metacall_value_copy (void * v )
193+ {
194+ return value_type_copy (v );
195+ }
196+
182197boolean metacall_value_to_bool (void * v )
183198{
184199 assert (value_type_id (v ) == TYPE_BOOL );
You can’t perform that action at this time.
0 commit comments