mirror of
https://github.com/netdata/netdata.git
synced 2025-05-06 18:20:10 +00:00
![]() * Move installation before concepts * Reorder installation links * Remove single node monitoring * Reorg libnetdata content |
||
---|---|---|
.. | ||
Makefile.am | ||
README.md | ||
string.c | ||
string.h | ||
utf8.h |
STRING
STRING provides a way to allocate and free text strings, while de-duplicating them.
It can be used similarly to libc string functions:
strdup()
andstrdupz()
becomestring_strdupz()
.strlen()
becomesstring_strlen()
(and it does not walkthrough the bytes of the string).free()
andfreez()
becomestring_freez()
.
There is also a special string_dup()
function that increases the reference counter of a STRING, avoiding the
index lookup to find it.
Once there is a STRING *
, the actual const char *
can be accessed with string2str()
.
All STRING should be constant. Changing the contents of a const char *
that has been acquired by string2str()
should never happen.