If STR_ALLOCATED
is set, Str
will call
free(data)
when:
data
.
data
using
attach()
.
If STR_ALLOCATED
is cleared, Str
will not call
free(data)
in the situations above. In the case where the buffer
needs to grow and STR_ALLOCATED
is clear, data is set to a new
buffer via malloc()
and STR_ALLOCATED
is set
automatically.
See chapter 5 for more information on allocating strings.
If STR_TIME_EFFICIENT
is set and a string needs to grow, its size will
be set to the next 2^n
power. Amortized analysis show that this
approach allows for efficient concatenation of string data.
The disadvantage is that a time-efficient string will require
up-to-twice the storage for the same data.
See chapter 9 for more information on time efficient strings.
If STR_EXTRA_BUFFER
is set, then the buffer size can be found
right after the terminating NULL in the string data. If cleared, the
buffer size is assumed to be the length of the string plus 1.