diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-10 15:13:15 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-10 15:13:15 -0400 |
commit | 4250d9bcfcf9dbc95418c64932ad39f71ff2019e (patch) | |
tree | a50b979c8817af4017e595928da6dc4524b37d40 /include/omc.h | |
parent | ed3f041df1d891b188fabfc055547c076ce6e85e (diff) | |
download | stasis-4250d9bcfcf9dbc95418c64932ad39f71ff2019e.tar.gz |
Use do/while in guard_* macros to make them behave more like functions
Diffstat (limited to 'include/omc.h')
-rw-r--r-- | include/omc.h | 6 |
1 files changed, 3 insertions, 3 deletions
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) { \ |