libyang 6.4.3
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
Loading...
Searching...
No Matches
ly_array.h File Reference

libyang sized array API. More...

#include <inttypes.h>
#include <stdlib.h>
Include dependency graph for ly_array.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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.
 

Detailed Description

libyang sized array API.

Author
Michal Vasko mvask.nosp@m.o@ce.nosp@m.snet..nosp@m.cz

Copyright (c) 2026 CESNET, z.s.p.o.

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 ly_array.h.