C Collections

cyaml · Section 3

cyaml_str_val

cyaml_str_val - extract a string value from a CYAML_STRING node

C Collections (libccollections, -lccollections)

#include <ccollections/cyaml.h>
 
const char *cyaml_str_val(cyaml node);

Returns a read-only pointer to the null-terminated string that node
stores.  The function calls ccol__fatal_err() when node is NULL and
when node is not of type CYAML_STRING.
 
The node owns the string, so the caller must not free the pointer.
It is borrowed and stays valid until the node gets a new value or is
destroyed, so any of these ends it: A cyaml_set(3) that reaches the
node, a cyaml_list_remove(3), cyaml_dictionary_remove(3) or
cyaml_remove(3) of the node, a cyaml_dictionary_set(3) that replaces
it, and a destroy of its tree.  Copy the text if you need it longer.

node  A CYAML_STRING node.

A pointer to the node's own string buffer.

cyaml_type(3), cyaml_create_string(3)