C Collections

cyaml · Section 3

cyaml_create_double_mp, cyaml_create_double

cyaml_create_double_mp, cyaml_create_double - allocate a YAML floating-point node

C Collections (libccollections, -lccollections)

#include <ccollections/cyaml.h>
 
cyaml cyaml_create_double_mp(double val, ccol_memmgmt_procs *mp);
cyaml cyaml_create_double(double val);

Allocates a DOM node of type CYAML_FLOAT.  YAML, unlike JSON, has a
form for values that are not finite, so the node accepts and stores
all three of them: +Inf serializes as .inf, -Inf as -.inf and NaN as
.nan.  cyaml_create_double() passes NULL for mp.

val  The double value, which can be finite, infinite or NaN.
mp   Custom allocator, or NULL for the default.
     The library keeps its own copy of the struct, so the caller may
     release or reuse the struct once this call returns.  The
     functions that it names must stay callable until the last node
     built with them is destroyed.  A process can use at most 64
     distinct sets of four functions, and a call that would need a
     65th fails and returns NULL.

A new cyaml node on success, NULL when the allocation fails.

cyaml_double_val(3), cyaml_destroy(3)