|
CX Framework
Cross-platform C utility framework
|
Functions | |
| void | stvarDestroy (stvar *stv) |
| void | stvarCopy (stvar *dvar, stvar svar) |
Functions for managing variant lifetime and copying.
void stvarCopy(stvar *dest, stvar source)
Deep copy a variant to another variant.
Copies both the type descriptor and value, performing appropriate operations for the contained type (incrementing reference counts for objects, duplicating strings, etc.). The destination variant should be uninitialized or previously destroyed to avoid leaking resources.
| dvar | Pointer to destination variant (overwritten) |
| svar | Source variant to copy (passed by value) |
Example:
|
inline |
Destroy a variant and release its resources.
Invokes the type-appropriate destructor on the contained value (e.g., decrements reference counts for objects, frees strings) and resets the type to none. After destruction, the variant is in a valid but empty state and can be safely destroyed again or reassigned.
| stv | Pointer to variant to destroy |
Example: