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:
@@ -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; \
|
||||
|
||||
Reference in New Issue
Block a user