diff options
author | Ben Smith <binjimin@gmail.com> | 2017-08-29 23:24:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-29 23:24:48 -0700 |
commit | 781e08e3ef857eb738fe54e6ef426717f99f5364 (patch) | |
tree | fc613a3e53d576bcb420d94dbaeefcae1051dd4d /src/common.h | |
parent | 7d33b3f26fc5aead990a35e4d089eaf2d5053202 (diff) | |
download | wabt-781e08e3ef857eb738fe54e6ef426717f99f5364.tar.gz wabt-781e08e3ef857eb738fe54e6ef426717f99f5364.tar.bz2 wabt-781e08e3ef857eb738fe54e6ef426717f99f5364.zip |
Move Result to its own file (result.h) (#600)
* Unify all uses of `CHECK_RESULT`
* Use `CHECK_RESULT` in a few more places
* Add `operator|` and `operator|=` to `Result`, use it instead of
`COMBINE_RESULT`
* Change a few occurrences of `!Succeeded` to `Failed`
Diffstat (limited to 'src/common.h')
-rw-r--r-- | src/common.h | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/common.h b/src/common.h index 370e0cbd..fab8b67c 100644 --- a/src/common.h +++ b/src/common.h @@ -31,6 +31,7 @@ #include <vector> #include "config.h" +#include "result.h" #include "string-view.h" #define WABT_FATAL(...) fprintf(stderr, __VA_ARGS__), exit(1) @@ -97,11 +98,6 @@ static const Address kInvalidAddress = ~0; static const Index kInvalidIndex = ~0; static const Offset kInvalidOffset = ~0; -enum class Result { - Ok, - Error, -}; - template<typename T> void ZeroMemory(T& v) { WABT_STATIC_ASSERT(std::is_pod<T>::value); @@ -145,9 +141,6 @@ typename T::value_type* DataOrNull(T& container) { return container.empty() ? nullptr : container.data(); } -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) StringPrintf(const char* format, ...) { va_list args; @@ -338,6 +331,6 @@ inline void ConvertBackslashToSlash(std::string* s) { ConvertBackslashToSlash(s->begin(), s->end()); } -} // end anonymous namespace +} // namespace wabt -#endif /* WABT_COMMON_H_ */ +#endif // WABT_COMMON_H_ |