libyang
3.4.2
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
|
libyang generic macros and functions to modify YANG schema or data trees. Intended for internal use and libyang plugins. More...
#include <stdlib.h>
Go to the source code of this file.
Macros | |
#define | LOGMEM(CTX) |
#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... | |
Functions | |
void * | ly_realloc (void *ptr, size_t size) |
Wrapper for realloc() call. The only difference is that if it fails to allocate the requested memory, the original memory is freed as well. More... | |
libyang generic macros and functions to modify YANG schema or data trees. Intended for internal use and libyang plugins.
This source code is licensed under BSD 3-Clause License (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at
https://opensource.org/licenses/BSD-3-Clause
Definition in file tree_edit.h.
#define LOGMEM | ( | CTX | ) |
Definition at line 22 of file tree_edit.h.
void* ly_realloc | ( | void * | ptr, |
size_t | size | ||
) |
Wrapper for realloc() call. The only difference is that if it fails to allocate the requested memory, the original memory is freed as well.
[in] | ptr | Memory to reallocate. |
[in] | size | New size of the memory block. |