diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-12 16:33:32 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-12 16:33:32 -0500 |
commit | 4e8732a2ad94982dcde175a6518da33021d2b6e8 (patch) | |
tree | 15007ccd3d06e41060b26f36fca3da24023f550e /src | |
parent | afecc407fd0d36061169ae64164703382656cafe (diff) | |
download | stasis-4e8732a2ad94982dcde175a6518da33021d2b6e8.tar.gz |
Encapsulate macro arguments in parentheses
Diffstat (limited to 'src')
-rw-r--r-- | src/cli/stasis_indexer/include/helpers.h | 4 | ||||
-rw-r--r-- | src/lib/core/include/conda.h | 2 | ||||
-rw-r--r-- | src/lib/core/include/core.h | 3 | ||||
-rw-r--r-- | src/lib/core/include/core_mem.h | 2 |
4 files changed, 5 insertions, 6 deletions
diff --git a/src/cli/stasis_indexer/include/helpers.h b/src/cli/stasis_indexer/include/helpers.h index d493f75..46705d2 100644 --- a/src/cli/stasis_indexer/include/helpers.h +++ b/src/cli/stasis_indexer/include/helpers.h @@ -5,12 +5,12 @@ #define ARRAY_COUNT_DYNAMIC(X, COUNTER) \ do { \ - for (COUNTER = 0; X && X[COUNTER] != NULL; COUNTER++) {} \ + for ((COUNTER) = 0; (X) && (X)[COUNTER] != NULL; (COUNTER)++) {} \ } while(0) #define ARRAY_COUNT_BY_STRUCT_MEMBER(X, MEMBER, COUNTER) \ do { \ - for (COUNTER = 0; X[COUNTER].MEMBER != NULL; COUNTER++) {} \ + for ((COUNTER) = 0; (X)[COUNTER].MEMBER != NULL; (COUNTER)++) {} \ } while(0) struct StrList *get_architectures(struct Delivery ctx[], size_t nelem); diff --git a/src/lib/core/include/conda.h b/src/lib/core/include/conda.h index b8d0caa..8b4a0bd 100644 --- a/src/lib/core/include/conda.h +++ b/src/lib/core/include/conda.h @@ -24,7 +24,7 @@ #define PKG_INDEX_PROVIDES_E_MANAGER_RUNTIME (PKG_INDEX_PROVIDES_ERROR_MESSAGE_OFFSET + 3) #define PKG_INDEX_PROVIDES_E_MANAGER_SIGNALED (PKG_INDEX_PROVIDES_ERROR_MESSAGE_OFFSET + 4) #define PKG_INDEX_PROVIDES_E_MANAGER_EXEC (PKG_INDEX_PROVIDES_ERROR_MESSAGE_OFFSET + 5) -#define PKG_INDEX_PROVIDES_FAILED(ECODE) (ECODE <= PKG_INDEX_PROVIDES_ERROR_MESSAGE_OFFSET) +#define PKG_INDEX_PROVIDES_FAILED(ECODE) ((ECODE) <= PKG_INDEX_PROVIDES_ERROR_MESSAGE_OFFSET) struct MicromambaInfo { char *micromamba_prefix; //!< Path to write micromamba binary diff --git a/src/lib/core/include/core.h b/src/lib/core/include/core.h index 362ac8d..f0586fa 100644 --- a/src/lib/core/include/core.h +++ b/src/lib/core/include/core.h @@ -26,7 +26,7 @@ #define COE_CHECK_ABORT(COND, MSG) \ do {\ - if (!globals.continue_on_error && COND) { \ + if (!globals.continue_on_error && (COND)) { \ msg(STASIS_MSG_ERROR, MSG ": Aborting execution (--continue-on-error/-C is not enabled)\n"); \ exit(1); \ } \ @@ -76,7 +76,6 @@ extern const char *VERSION; extern const char *AUTHOR; extern const char *BANNER; - /** * Free memory allocated in global configuration structure */ diff --git a/src/lib/core/include/core_mem.h b/src/lib/core/include/core_mem.h index bd50e9d..362715f 100644 --- a/src/lib/core/include/core_mem.h +++ b/src/lib/core/include/core_mem.h @@ -5,7 +5,7 @@ #include "environment.h" #include "strlist.h" -#define guard_runtime_free(X) do { if (X) { runtime_free(X); X = NULL; } } while (0) +#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 GENERIC_ARRAY_FREE(ARR) do { \ |