From a32a8504c9fdca3a021652489798352c9f71aca0 Mon Sep 17 00:00:00 2001 From: Guido Casati <hello@guidocasati.com> Date: Wed, 25 Sep 2024 11:33:42 +0200 Subject: [PATCH] Use a macro to initialize NR_SetupRelease structs * introduced macro INIT_SETUP_RELEASE to optimize code in gnb_config.c --- openair2/GNB_APP/gnb_config.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 2195acefb13..2da9f672522 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -95,6 +95,16 @@ #include "nfapi/oai_integration/aerial/fapi_vnf_p5.h" #endif +/** + * @brief Helper define to allocate and initialize SetupRelease structures + */ +#define INIT_SETUP_RELEASE(type, element) \ + do { \ + element = calloc_or_fail(1, sizeof(*element)); \ + (element)->present = NR_SetupRelease_##type##_PR_setup; \ + (element)->choice.setup = CALLOC(1, sizeof(*((element)->choice.setup))); \ + } while (0) + extern uint16_t sf_ahead; void prepare_scc(NR_ServingCellConfigCommon_t *scc) { -- GitLab