aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-04-30 18:52:24 -0400
committerDavid Robillard <d@drobilla.net>2023-04-30 19:40:06 -0400
commit048f9b415670d1630c5cb25ffc4385c6a11fdc6b (patch)
treed743159740a43f8087d013dca5d6cc82c7ecd919 /include
parentaa5cc3fb1fa33608dbfafcca40902ef1d102261c (diff)
downloadlv2-048f9b415670d1630c5cb25ffc4385c6a11fdc6b.tar.xz
Avoid or suppress clang-tidy warnings in utility headers
Diffstat (limited to 'include')
-rw-r--r--include/lv2/atom/forge.h15
-rw-r--r--include/lv2/atom/util.h8
2 files changed, 18 insertions, 5 deletions
diff --git a/include/lv2/atom/forge.h b/include/lv2/atom/forge.h
index 5110b99..5656079 100644
--- a/include/lv2/atom/forge.h
+++ b/include/lv2/atom/forge.h
@@ -316,11 +316,18 @@ lv2_atom_forge_write(LV2_Atom_Forge* forge, const void* data, uint32_t size)
static inline LV2_Atom_Forge_Ref
lv2_atom_forge_string_body(LV2_Atom_Forge* forge, const char* str, uint32_t len)
{
- LV2_Atom_Forge_Ref out = lv2_atom_forge_raw(forge, str, len);
- if (out && (out = lv2_atom_forge_raw(forge, "", 1))) {
- lv2_atom_forge_pad(forge, len + 1);
+ const LV2_Atom_Forge_Ref s = lv2_atom_forge_raw(forge, str, len);
+ if (!s) {
+ return s;
}
- return out;
+
+ const LV2_Atom_Forge_Ref t = lv2_atom_forge_raw(forge, "", 1);
+ if (!t) {
+ return t;
+ }
+
+ lv2_atom_forge_pad(forge, len + 1U);
+ return t;
}
/**
diff --git a/include/lv2/atom/util.h b/include/lv2/atom/util.h
index f641619..556fb58 100644
--- a/include/lv2/atom/util.h
+++ b/include/lv2/atom/util.h
@@ -28,6 +28,8 @@
#include <stdint.h>
#include <string.h>
+// NOLINTBEGIN(bugprone-macro-parentheses)
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -36,7 +38,9 @@ extern "C" {
static inline uint32_t
lv2_atom_pad_size(uint32_t size)
{
- return (size + 7U) & (~7U);
+ static const uint32_t mask = 7U;
+
+ return (size + mask) & ~mask;
}
/** Return the total size of `atom`, including the header. */
@@ -501,6 +505,8 @@ lv2_atom_object_get_typed(const LV2_Atom_Object* object, ...)
} /* extern "C" */
#endif
+// NOLINTEND(bugprone-macro-parentheses)
+
/**
@}
@}