From c520a4e295c261e46e096e2542f0b82892a8bc3a Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Thu, 23 Jan 2025 12:56:53 +0100 Subject: [PATCH] Refactor some scope macros Use do {} while (0) for UEdumpScopeData/gNBdumpScopeData macro --- openair1/PHY/TOOLS/phy_scope_interface.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/openair1/PHY/TOOLS/phy_scope_interface.h b/openair1/PHY/TOOLS/phy_scope_interface.h index 1bdb52181a..59e7d93dd9 100644 --- a/openair1/PHY/TOOLS/phy_scope_interface.h +++ b/openair1/PHY/TOOLS/phy_scope_interface.h @@ -158,11 +158,13 @@ void copyData(void *, enum scopeDataType type, void *dataIn, int elementSz, int scope_data->unlockScopeData(type); \ } -#define gNBdumpScopeData(gnb, slot, frame, cause_string) \ - scopeData_t *scope_data = (scopeData_t *)gnb->scopeData; \ - if (scope_data && scope_data->dumpScopeData) { \ - scope_data->dumpScopeData(slot, frame, cause_string); \ - } +#define gNBdumpScopeData(gnb, slot, frame, cause_string) \ + do { \ + scopeData_t *scope_data = (scopeData_t *)gnb->scopeData; \ + if (scope_data && scope_data->dumpScopeData) { \ + scope_data->dumpScopeData((slot), (frame), (cause_string)); \ + } \ + } while (0) #define UEScopeHasTryLock(ue) \ (ue->scopeData && ((scopeData_t *)ue->scopeData)->tryLockScopeData) @@ -183,11 +185,13 @@ void copyData(void *, enum scopeDataType type, void *dataIn, int elementSz, int scope_data->unlockScopeData(type); \ } -#define UEdumpScopeData(ue, slot, frame, cause_string) \ - scopeData_t *scope_data = (scopeData_t *)ue->scopeData; \ - if (scope_data && scope_data->dumpScopeData) { \ - scope_data->dumpScopeData(slot, frame, cause_string); \ - } \ +#define UEdumpScopeData(ue, slot, frame, cause_string) \ + do { \ + scopeData_t *scope_data = (scopeData_t *)ue->scopeData; \ + if (scope_data && scope_data->dumpScopeData) { \ + scope_data->dumpScopeData((slot), (frame), (cause_string)); \ + } \ + } while (0) #ifdef __cplusplus extern "C" {