![]() |
libyang 6.4.3
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
|
Macros | |
| #define | LYA_ADD(ARRAY, EACTION) |
| Allocate memory for a new item in a sized array. | |
| #define | LYA_ADD_ITEM(ARRAY, NEW_ITEM, EACTION) |
| Allocate memory for a new item in a sized array. | |
| #define | LYA_COUNT(ARRAY) (ARRAY ? LYA_COUNT_(ARRAY) : 0) |
| Get the number of records in the ARRAY. | |
| #define | LYA_COUNT_(ARRAY) (*((LYA_COUNT_T *)(ARRAY) - 1)) |
| Internal macro, do not use. | |
| #define | LYA_COUNT_T uint64_t |
| Type (i.e. size) of the sized array's size counter. | |
| #define | LYA_DECREMENT(ARRAY) --LYA_COUNT_(ARRAY) |
| Decrement the items counter of a sized array. | |
| #define | LYA_DECREMENT_FREE(ARRAY) |
| Decrement the items counter of a sized array. Free and zero the whole array in case the count was decremented to 0. | |
| #define | LYA_FOR(ARRAY, INDEX) |
| Helper macro to go through sized-arrays with a numeric iterator. | |
| #define | LYA_FOR_EACH(ARRAY, ITER) |
| Helper macro to go through sized-arrays with a pointer iterator. | |
| #define | LYA_FREE(ARRAY) |
| Free the space allocated for a sized array. | |
| #define | LYA_INCREMENT(ARRAY) ++LYA_COUNT_(ARRAY) |
| Increment the items counter of a sized array. | |
| #define | LYA_NEW(ARRAY, COUNT, EACTION) |
| Allocate memory of a sized array or resize an existing array. | |
| #define | LYA_PREALLOC(ARRAY, COUNT, EACTION) |
| Allocate memory of a sized array or resize an existing array. | |
| #define | LYA_PRI_COUNT_T PRIu64 |
| Printing format specifier macro for LYA_COUNT_T values. | |
| #define | LYA_REMOVE_VALUE(ARRAY, VALUE) |
| Remove a specific value from a sized array. | |
Generic macros for LY array handling that includes the information about its size.
| #define LYA_ADD | ( | ARRAY, | |
| EACTION | |||
| ) |
Allocate memory for a new item in a sized array.
Updates the size information.
New item is zeroed.
| [in,out] | ARRAY | Sized array to manipulate. |
| [in] | EACTION | Error action on memory allocation error, must include 'return' or 'goto' commands. |
Definition at line 138 of file ly_array.h.
| #define LYA_ADD_ITEM | ( | ARRAY, | |
| NEW_ITEM, | |||
| EACTION | |||
| ) |
Allocate memory for a new item in a sized array.
Updates the size information.
New item is zeroed.
| [in,out] | ARRAY | Sized array to manipulate. |
| [out] | NEW_ITEM | Pointer to the new item. |
| [in] | EACTION | Error action on memory allocation error, must include 'return' or 'goto' commands. |
Definition at line 153 of file ly_array.h.
| #define LYA_COUNT | ( | ARRAY | ) | (ARRAY ? LYA_COUNT_(ARRAY) : 0) |
Get the number of records in the ARRAY.
| [in] | ARRAY | Sized array to manipulate. |
Definition at line 78 of file ly_array.h.
| #define LYA_COUNT_ | ( | ARRAY | ) | (*((LYA_COUNT_T *)(ARRAY) - 1)) |
Internal macro, do not use.
Definition at line 83 of file ly_array.h.
| #define LYA_COUNT_T uint64_t |
Type (i.e. size) of the sized array's size counter.
To print the value via a print format, use LYA_PRI_COUNT_T specifier.
Definition at line 38 of file ly_array.h.
| #define LYA_DECREMENT | ( | ARRAY | ) | --LYA_COUNT_(ARRAY) |
Decrement the items counter of a sized array.
Does not change the allocated memory used by the ARRAY. To do so, use LYA_PREALLOC.
| [in,out] | ARRAY | Sized array to manipulate. |
Definition at line 174 of file ly_array.h.
| #define LYA_DECREMENT_FREE | ( | ARRAY | ) |
Decrement the items counter of a sized array. Free and zero the whole array in case the count was decremented to 0.
| [in,out] | ARRAY | Sized array to manipulate. |
Definition at line 183 of file ly_array.h.
| #define LYA_FOR | ( | ARRAY, | |
| INDEX | |||
| ) |
Helper macro to go through sized-arrays with a numeric iterator.
Use with opening curly bracket ({).
The item on the current INDEX in the ARRAY can be accessed in a standard C way as ARRAY[INDEX].
| [in] | ARRAY | Sized array to manipulate. |
| [out] | INDEX | Variable for the iterating index of the item being processed in each loop. |
Definition at line 55 of file ly_array.h.
| #define LYA_FOR_EACH | ( | ARRAY, | |
| ITER | |||
| ) |
Helper macro to go through sized-arrays with a pointer iterator.
Use with opening curly bracket ({).
| [in] | ARRAY | Sized array to manipulate. |
| [out] | ITER | Iterating pointer to the item being processed in each loop. |
Definition at line 68 of file ly_array.h.
| #define LYA_FREE | ( | ARRAY | ) |
Free the space allocated for a sized array.
The items inside the array are not freed.
| [in,out] | ARRAY | Sized array to manipulate. |
Definition at line 197 of file ly_array.h.
| #define LYA_INCREMENT | ( | ARRAY | ) | ++LYA_COUNT_(ARRAY) |
Increment the items counter of a sized array.
Does not change the allocated memory used by the ARRAY. To do so, use LYA_PREALLOC.
| [in,out] | ARRAY | Sized array to manipulate. |
Definition at line 164 of file ly_array.h.
| #define LYA_NEW | ( | ARRAY, | |
| COUNT, | |||
| EACTION | |||
| ) |
Allocate memory of a sized array or resize an existing array.
Updates the size information unlike LYA_PREALLOC.
Any new memory is zeroed.
| [in,out] | ARRAY | Sized array to manipulate. |
| [in] | COUNT | New count (size) of the items in the array. |
| [in] | EACTION | Error action on memory allocation error, must include 'return' or 'goto' commands. |
Definition at line 124 of file ly_array.h.
| #define LYA_PREALLOC | ( | ARRAY, | |
| COUNT, | |||
| EACTION | |||
| ) |
Allocate memory of a sized array or resize an existing array.
Does not set the size information, it is supposed to be incremented via LYA_INCREMENT when the items are filled.
Any new memory is zeroed.
| [in,out] | ARRAY | Sized array to manipulate. |
| [in] | COUNT | New count (size) of the items in the array. |
| [in] | EACTION | Error action on memory allocation error, must include 'return' or 'goto' commands. |
Definition at line 97 of file ly_array.h.
| #define LYA_PRI_COUNT_T PRIu64 |
Printing format specifier macro for LYA_COUNT_T values.
Definition at line 43 of file ly_array.h.
| #define LYA_REMOVE_VALUE | ( | ARRAY, | |
| VALUE | |||
| ) |
Remove a specific value from a sized array.
| [in,out] | ARRAY | Sized array to manipulate. |
| [in] | VALUE | Value to remove, only the first occurence is removed. |
Definition at line 208 of file ly_array.h.