libyang
3.4.2
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
|
Macros | |
#define | LY_ARRAY_CREATE(CTX, ARRAY, SIZE, EACTION) |
Allocate a (sized array) for the specified number of items. If the ARRAY already exists, it is resized (space for SIZE items is added and zeroed). More... | |
#define | LY_ARRAY_CREATE_GOTO(CTX, ARRAY, SIZE, RET, GOTO) LY_ARRAY_CREATE(CTX, ARRAY, SIZE, RET = LY_EMEM; goto GOTO) |
Allocate a (sized array) for the specified number of items. If the ARRAY already exists, it is resized (space for SIZE items is added). More... | |
#define | LY_ARRAY_CREATE_RET(CTX, ARRAY, SIZE, RETVAL) LY_ARRAY_CREATE(CTX, ARRAY, SIZE, return RETVAL) |
Allocate a (sized array) for the specified number of items. If the ARRAY already exists, it is resized (space for SIZE items is added and zeroed). More... | |
#define | LY_ARRAY_DECREMENT(ARRAY) --(*((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1)) |
Decrement the items counter in a (sized array). More... | |
#define | LY_ARRAY_DECREMENT_FREE(ARRAY) |
Decrement the items counter in a (sized array) and free the whole array in case it was decremented to 0. More... | |
#define | LY_ARRAY_FREE(ARRAY) if (ARRAY){free((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1);} |
Free the space allocated for the (sized array). More... | |
#define | LY_ARRAY_INCREMENT(ARRAY) ++(*((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1)) |
Increment the items counter in a (sized array). More... | |
#define | LY_ARRAY_NEW(CTX, ARRAY, EACTION) |
(Re-)Allocation of a (sized array). More... | |
#define | LY_ARRAY_NEW_GOTO(CTX, ARRAY, NEW_ITEM, RET, GOTO) |
(Re-)Allocation of a (sized array). More... | |
#define | LY_ARRAY_NEW_RET(CTX, ARRAY, NEW_ITEM, RETVAL) |
(Re-)Allocation of a (sized array). More... | |
#define | LY_ARRAY_REMOVE_VALUE(ARRAY, VALUE) |
Remove item from array based on value. More... | |
#define | LY_LIST_INSERT(LIST, NEW_ITEM, LINKER) |
Insert item into linked list. More... | |
#define | LY_LIST_NEW(CTX, LIST, NEW_ITEM, LINKER, EACTION) |
Allocate and insert new item into linked list, return in case of error. More... | |
#define | LY_LIST_NEW_GOTO(CTX, LIST, NEW_ITEM, LINKER, RET, LABEL) LY_LIST_NEW(CTX, LIST, NEW_ITEM, LINKER, RET = LY_EMEM; goto LABEL) |
Allocate and insert new item into linked list, goto specified label in case of error. More... | |
#define | LY_LIST_NEW_RET(CTX, LIST, NEW_ITEM, LINKER, RETVAL) LY_LIST_NEW(CTX, LIST, NEW_ITEM, LINKER, return RETVAL) |
Allocate and insert new item into linked list, return in case of error. More... | |
Generic macros, functions, etc. to modify schema and data trees.
#define LY_ARRAY_CREATE | ( | CTX, | |
ARRAY, | |||
SIZE, | |||
EACTION | |||
) |
Allocate a (sized array) for the specified number of items. If the ARRAY already exists, it is resized (space for SIZE items is added and zeroed).
Does not set the size information, it is supposed to be incremented via LY_ARRAY_INCREMENT when the items are filled.
This is a generic macro for LY_ARRAY_CREATE_RET and LY_ARRAY_CREATE_GOTO.
[in] | CTX | libyang context for logging. |
[in,out] | ARRAY | Pointer to the array to create. |
[in] | SIZE | Number of the new items the array is supposed to hold. The size of the allocated space is then counted from the type of the ARRAY, so do not provide placeholder void pointers. |
[in] | EACTION | Action to perform in case of error (memory allocation failure). |
Definition at line 132 of file tree_edit.h.
#define LY_ARRAY_CREATE_GOTO | ( | CTX, | |
ARRAY, | |||
SIZE, | |||
RET, | |||
GOTO | |||
) | LY_ARRAY_CREATE(CTX, ARRAY, SIZE, RET = LY_EMEM; goto GOTO) |
Allocate a (sized array) for the specified number of items. If the ARRAY already exists, it is resized (space for SIZE items is added).
Does not set the count information, it is supposed to be incremented via LY_ARRAY_INCREMENT when the items are filled.
[in] | CTX | libyang context for logging. |
[in,out] | ARRAY | Pointer to the array to create. |
[in] | SIZE | Number of the new items the array is supposed to hold. The size of the allocated space is then counted from the type of the ARRAY, so do not provide placeholder void pointers. |
[out] | RET | Variable to store error code. |
[in] | GOTO | Label to go in case of error (memory allocation failure). |
Definition at line 186 of file tree_edit.h.
#define LY_ARRAY_CREATE_RET | ( | CTX, | |
ARRAY, | |||
SIZE, | |||
RETVAL | |||
) | LY_ARRAY_CREATE(CTX, ARRAY, SIZE, return RETVAL) |
Allocate a (sized array) for the specified number of items. If the ARRAY already exists, it is resized (space for SIZE items is added and zeroed).
Does not set the size information, it is supposed to be incremented via LY_ARRAY_INCREMENT when the items are filled.
[in] | CTX | libyang context for logging. |
[in,out] | ARRAY | Pointer to the array to create. |
[in] | SIZE | Number of the new items the array is supposed to hold. The size of the allocated space is then counted from the type of the ARRAY, so do not provide placeholder void pointers. |
[in] | RETVAL | Return value for the case of error (memory allocation failure). |
Definition at line 169 of file tree_edit.h.
#define LY_ARRAY_DECREMENT | ( | ARRAY | ) | --(*((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1)) |
Decrement the items counter in a (sized array).
Does not change the allocated memory used by the ARRAY. To do so, use LY_ARRAY_CREATE_RET, LY_ARRAY_CREATE_GOTO or LY_ARRAY_RESIZE_ERR_RET.
[in] | ARRAY | Pointer to the array to affect. |
Definition at line 208 of file tree_edit.h.
#define LY_ARRAY_DECREMENT_FREE | ( | ARRAY | ) |
Decrement the items counter in a (sized array) and free the whole array in case it was decremented to 0.
[in] | ARRAY | Pointer to the array to affect. |
Definition at line 217 of file tree_edit.h.
#define LY_ARRAY_FREE | ( | ARRAY | ) | if (ARRAY){free((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1);} |
Free the space allocated for the (sized array).
The items inside the array are not freed.
[in] | ARRAY | A (sized array) to be freed. |
Definition at line 231 of file tree_edit.h.
#define LY_ARRAY_INCREMENT | ( | ARRAY | ) | ++(*((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1)) |
Increment the items counter in a (sized array).
Does not change the allocated memory used by the ARRAY. To do so, use LY_ARRAY_CREATE_RET, LY_ARRAY_CREATE_GOTO or LY_ARRAY_RESIZE_ERR_RET.
[in] | ARRAY | Pointer to the array to affect. |
Definition at line 197 of file tree_edit.h.
#define LY_ARRAY_NEW | ( | CTX, | |
ARRAY, | |||
EACTION | |||
) |
(Re-)Allocation of a (sized array).
Increases the size information.
This is a generic macro for LY_ARRAY_NEW_RET and LY_ARRAY_NEW_GOTO.
[in] | CTX | libyang context for logging. |
[in,out] | ARRAY | Pointer to the array to allocate/resize. The size of the allocated space is counted from the type of the ARRAY, so do not provide placeholder void pointers. |
[in] | EACTION | Action to perform in case of error (memory allocation failure). |
Definition at line 60 of file tree_edit.h.
#define LY_ARRAY_NEW_GOTO | ( | CTX, | |
ARRAY, | |||
NEW_ITEM, | |||
RET, | |||
GOTO | |||
) |
(Re-)Allocation of a (sized array).
Increases the size information.
[in] | CTX | libyang context for logging. |
[in,out] | ARRAY | Pointer to the array to allocate/resize. The size of the allocated space is counted from the type of the ARRAY, so do not provide placeholder void pointers. |
[out] | NEW_ITEM | Returning pointer to the newly allocated record in the ARRAY. |
[out] | RET | Variable to store error code. |
[in] | GOTO | Label to go in case of error (memory allocation failure). |
Definition at line 112 of file tree_edit.h.
#define LY_ARRAY_NEW_RET | ( | CTX, | |
ARRAY, | |||
NEW_ITEM, | |||
RETVAL | |||
) |
(Re-)Allocation of a (sized array).
Increases the size information.
[in] | CTX | libyang context for logging. |
[in,out] | ARRAY | Pointer to the array to allocate/resize. The size of the allocated space is counted from the type of the ARRAY, so do not provide placeholder void pointers. |
[out] | NEW_ITEM | Returning pointer to the newly allocated record in the ARRAY. |
[in] | RETVAL | Return value for the case of error (memory allocation failure). |
Definition at line 95 of file tree_edit.h.
#define LY_ARRAY_REMOVE_VALUE | ( | ARRAY, | |
VALUE | |||
) |
Remove item from array based on value.
[in,out] | ARRAY | A (sized array) to be modified. |
[in] | VALUE | The item value to be removed. Only the first occurence will be removed. |
Definition at line 240 of file tree_edit.h.
#define LY_LIST_INSERT | ( | LIST, | |
NEW_ITEM, | |||
LINKER | |||
) |
Insert item into linked list.
[in,out] | LIST | Linked list to add to. |
[in] | NEW_ITEM | New item, that will be appended to the list, must be already allocated. |
[in] | LINKER | name of structuring member that is used to connect items together. |
Definition at line 261 of file tree_edit.h.
#define LY_LIST_NEW | ( | CTX, | |
LIST, | |||
NEW_ITEM, | |||
LINKER, | |||
EACTION | |||
) |
Allocate and insert new item into linked list, return in case of error.
This is a generic macro for LY_LIST_NEW_RET and LY_LIST_NEW_GOTO.
[in] | CTX | used for logging. |
[in,out] | LIST | Linked list to add to. |
[out] | NEW_ITEM | New item that is appended to the list. |
[in] | LINKER | name of structure member that is used to connect items together. |
[in] | EACTION | Action to perform in case of error (memory allocation failure). |
Definition at line 284 of file tree_edit.h.
#define LY_LIST_NEW_GOTO | ( | CTX, | |
LIST, | |||
NEW_ITEM, | |||
LINKER, | |||
RET, | |||
LABEL | |||
) | LY_LIST_NEW(CTX, LIST, NEW_ITEM, LINKER, RET = LY_EMEM; goto LABEL) |
Allocate and insert new item into linked list, goto specified label in case of error.
[in] | CTX | used for logging. |
[in,out] | LIST | Linked list to add to. |
[out] | NEW_ITEM | New item that is appended to the list. |
[in] | LINKER | name of structure member that is used to connect items together. |
[in] | RET | variable to store returned error type. |
[in] | LABEL | label to goto in case of error. |
Definition at line 317 of file tree_edit.h.
#define LY_LIST_NEW_RET | ( | CTX, | |
LIST, | |||
NEW_ITEM, | |||
LINKER, | |||
RETVAL | |||
) | LY_LIST_NEW(CTX, LIST, NEW_ITEM, LINKER, return RETVAL) |
Allocate and insert new item into linked list, return in case of error.
[in] | CTX | used for logging. |
[in,out] | LIST | Linked list to add to. |
[out] | NEW_ITEM | New item that is appended to the list. |
[in] | LINKER | name of structure member that is used to connect items together. |
[in] | RETVAL | Return value for the case of error (memory allocation failure). |
Definition at line 304 of file tree_edit.h.