From 4250d9bcfcf9dbc95418c64932ad39f71ff2019e Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 10 Mar 2024 15:13:15 -0400 Subject: Use do/while in guard_* macros to make them behave more like functions --- include/omc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/omc.h') diff --git a/include/omc.h b/include/omc.h index c5edef1..11252b1 100644 --- a/include/omc.h +++ b/include/omc.h @@ -35,9 +35,9 @@ #include "recipe.h" #include "relocation.h" -#define guard_runtime_free(X) if (X) { runtime_free(X); X = NULL; } -#define guard_strlist_free(X) if (X) { strlist_free(X); X = NULL; } -#define guard_free(X) if (X) { free(X); X = NULL; } +#define guard_runtime_free(X) do { if (X) { runtime_free(X); X = NULL; } } while (0) +#define guard_strlist_free(X) do { if (X) { strlist_free(X); X = NULL; } } while (0) +#define guard_free(X) do { if (X) { free(X); X = NULL; } } while (0) #define COE_CHECK_ABORT(COND, MSG) {\ if (COND) { \ -- cgit