diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-10-25 14:48:51 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-25 14:48:51 +0000 |
commit | 232a30488cd016439ab6455193c1f8424014cea2 (patch) | |
tree | 9fbff0fa4878aa6ca11a7a4f9d4141ff40332402 | |
parent | 4f0c0ed93f0472f79567c71a082dcd7543b4273c (diff) | |
download | mongo-232a30488cd016439ab6455193c1f8424014cea2.tar.gz |
SERVER-44185 Convert keyStringAssert() and keyStringAsserted() into a macro to avoid evaluating parameters early
-rw-r--r-- | src/mongo/db/storage/key_string.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/mongo/db/storage/key_string.cpp b/src/mongo/db/storage/key_string.cpp index e9e47cbf6fa..bd796938714 100644 --- a/src/mongo/db/storage/key_string.cpp +++ b/src/mongo/db/storage/key_string.cpp @@ -45,6 +45,11 @@ #include "mongo/util/hex.h" #include "mongo/util/log.h" +#define keyStringAssert(msgid, msg, expr) \ + uassert(msgid, str::stream() << "KeyString format error: " << msg, expr) +#define keyStringAsserted(msgid, msg) \ + uasserted(msgid, str::stream() << "KeyString format error: " << msg) + namespace mongo { using std::string; @@ -234,14 +239,6 @@ const uint8_t kGreater = 254; // some utility functions namespace { -void keyStringAssert(const int msgid, const std::string msg, const bool expr) { - uassert(msgid, str::stream() << "KeyString format error: " << msg, expr); -} - -void keyStringAsserted(const int msgid, const std::string msg) { - uasserted(msgid, str::stream() << "KeyString format error: " << msg); -} - void memcpy_flipBits(void* dst, const void* src, size_t bytes) { const char* input = static_cast<const char*>(src); char* output = static_cast<char*>(dst); |