Generalize F1AP_LIB_FIND_IE() to work with list container

F1AP_LIB_FIND_IE() is used to look up elements in a list, but was
hitherto hardcoded to use "protocolIEs" as an intermediate struct. A
follow-up commit will use this macro where we don't have protocolIEs,
but "iE_Extensions". Hence, modify to make it work for that case (and
others) as well.
This commit is contained in:
Robert Schmidt
2025-06-27 11:40:54 +02:00
parent e991f26ff1
commit 3a4440a99c
3 changed files with 36 additions and 35 deletions
+2 -4
View File
@@ -68,12 +68,10 @@
/* macro to look up IE. If mandatory and not found, macro will print
* descriptive debug message to stderr and force exit in calling function */
#define F1AP_LIB_FIND_IE(IE_TYPE, ie, container, IE_ID, mandatory) \
#define F1AP_LIB_FIND_IE(IE_TYPE, ie, IE_LIST, IE_ID, mandatory) \
do { \
ie = NULL; \
for (IE_TYPE **ptr = container->protocolIEs.list.array; \
ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \
ptr++) { \
for (IE_TYPE **ptr = (IE_LIST)->array; ptr < &(IE_LIST)->array[(IE_LIST)->count]; ptr++) { \
if ((*ptr)->id == IE_ID) { \
ie = *ptr; \
break; \