0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-05-06 18:20:10 +00:00
netdata_netdata/libnetdata/string
Chris Akritidis f9acc1aead
More learn reorg/reordering ()
* Move installation before concepts

* Reorder installation links

* Remove single node monitoring

* Reorg libnetdata content
2023-02-10 11:21:10 -08:00
..
Makefile.am RRD structures managed by dictionaries () 2022-09-19 23:46:13 +03:00
README.md More learn reorg/reordering () 2023-02-10 11:21:10 -08:00
string.c Virtual hosts for data collection () 2023-02-09 20:27:05 +02:00
string.h Virtual hosts for data collection () 2023-02-09 20:27:05 +02:00
utf8.h Utf8 Badge Fix And URL Parser International Support (initial) () 2019-07-24 14:32:08 +02:00

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() and strdupz() become string_strdupz().
  • strlen() becomes string_strlen() (and it does not walkthrough the bytes of the string).
  • free() and freez() become string_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.