summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/common.h b/src/common.h
index 237910c0..04cd39fc 100644
--- a/src/common.h
+++ b/src/common.h
@@ -33,10 +33,6 @@
#define WABT_FATAL(...) fprintf(stderr, __VA_ARGS__), exit(1)
#define WABT_ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define WABT_ZERO_MEMORY(var) \
- WABT_STATIC_ASSERT( \
- std::is_pod<std::remove_reference<decltype(var)>::type>::value); \
- memset(static_cast<void*>(&(var)), 0, sizeof(var))
#define WABT_USE(x) static_cast<void>(x)
@@ -103,8 +99,14 @@ enum class Result {
Error,
};
-#define WABT_SUCCEEDED(x) ((x) == ::wabt::Result::Ok)
-#define WABT_FAILED(x) ((x) == ::wabt::Result::Error)
+template<typename T>
+void ZeroMemory(T& v) {
+ WABT_STATIC_ASSERT(std::is_pod<T>::value);
+ memset(&v, 0, sizeof(v));
+}
+
+inline bool Succeeded(Result result) { return result == Result::Ok; }
+inline bool Failed(Result result) { return result == Result::Error; }
inline std::string WABT_PRINTF_FORMAT(1, 2)
string_printf(const char* format, ...) {