FreeWRL/FreeX3D  3.0.0
cson_string Struct Reference

Strings are allocated as an instances of this class with N+1 trailing bytes, where N is the length of the string being allocated. More...

#include <cson_amalgamation_core.h>

Data Fields

unsigned int length
 

Detailed Description

Strings are allocated as an instances of this class with N+1 trailing bytes, where N is the length of the string being allocated.

cson-internal string type, opaque to client code.

To convert a cson_string to c-string we simply increment the cson_string pointer. To do the opposite we use (cstr - sizeof(cson_string)). Zero-length strings are a special case handled by a couple of the cson_string functions.

Strings in cson are immutable and allocated only by library internals, never directly by client code.

The actual string bytes are to be allocated together in the same memory chunk as the cson_string object, which saves us 1 malloc() and 1 pointer member in this type (because we no longer have a direct pointer to the memory).

Potential TODOs:

See Also
cson_string_cstr()

Definition at line 1578 of file cson_amalgamation_core.c.


The documentation for this struct was generated from the following file: