libyang
3.4.2
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
|
Context includes dictionary to store strings more effectively. The most of strings repeats quite often in schema as well as data trees. Therefore, instead of allocating those strings each time they appear, libyang stores them as records in the dictionary. The basic API to the context dictionary is public, so even a caller application can use the dictionary.
To insert a string into the dictionary, caller can use lydict_insert() (adding a constant string) or lydict_insert_zc() (for dynamically allocated strings that won't be used by the caller after its insertion into the dictionary). Both functions provide the pointer to the inserted string in the dictionary record.
To remove (reference of the) string from the context dictionary, lydict_remove() is supposed to be used.