diff options
author | Pierre Langlois <pierre.langlois@arm.com> | 2015-03-09 10:44:37 +0000 |
---|---|---|
committer | Pierre Langlois <pierre.langlois@arm.com> | 2016-03-04 17:46:38 +0000 |
commit | bb10989825f7d545ab74b102c02daaf79cee323a (patch) | |
tree | 5ce23f864c0d68cccf30c66bfa5b7bd9650b5b10 | |
parent | dca91a8c666240d3d9b5e916e28843833c320010 (diff) | |
download | kdbinder-bb10989825f7d545ab74b102c02daaf79cee323a.tar.gz |
libkdbinder: kdbus: preprend assertion macros with KDBUS_
This would prevent conflicts with libraries using libkdbinder and
defining their own macros for assertion with the same names.
Change-Id: I2ca04fc0e6f6fdee4398320b2b945e41e54648d9
-rw-r--r-- | libs/kdbinder/kdbus/connection.cpp | 12 | ||||
-rw-r--r-- | libs/kdbinder/kdbus/globals.h | 14 | ||||
-rw-r--r-- | libs/kdbinder/kdbus/item.cpp | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/libs/kdbinder/kdbus/connection.cpp b/libs/kdbinder/kdbus/connection.cpp index 80f4b6d..27958a7 100644 --- a/libs/kdbinder/kdbus/connection.cpp +++ b/libs/kdbinder/kdbus/connection.cpp @@ -187,7 +187,7 @@ std::vector<NameInfo> Connection::name_list(uint64_t flags) const { const Reply Connection::queue_message(const Message& message) const { // The source id of the message should match us. - CHECK(message.src_id() == id); + KDBUS_CHECK(message.src_id() == id); auto reply = send_command_send_message(bus_file_.get(), message); @@ -266,11 +266,11 @@ const DataReply Connection::dequeue_message_blocking(int timeout_ms) const { const DataReply Connection::transact(const MessageSync& message) const { // The source id of the message should match us. - CHECK(message.src_id() == id); + KDBUS_CHECK(message.src_id() == id); // A transaction needs a non-zero cookie, otherwise we will not be able to // identify the reply. - CHECK(message.cookie() != 0); + KDBUS_CHECK(message.cookie() != 0); auto reply = send_command_transact_message(bus_file_.get(), message); @@ -286,7 +286,7 @@ const DataReply Connection::transact(const MessageSync& message) const { std::vector<DataReply::Data> vecs; // We should have received a reply with a matching cookie. - CHECK(message.cookie() == msg->cookie_reply); + KDBUS_CHECK(message.cookie() == msg->cookie_reply); // TODO: parse the rest of the items for extra information. for_each_item(msg, [&vecs, address = buf_.get()](struct kdbus_item *item) { @@ -316,11 +316,11 @@ const DataReply Connection::transact(const MessageSync& message) const { const Reply Connection::reply(const MessageReply& message) const { // The source id of the message should match us. - CHECK(message.src_id() == id); + KDBUS_CHECK(message.src_id() == id); // A reply needs a non-zero cookie_reply, as it needs to match the Message we // are replying to. - CHECK(message.cookie_reply() != 0); + KDBUS_CHECK(message.cookie_reply() != 0); auto reply = send_command_send_message(bus_file_.get(), message); diff --git a/libs/kdbinder/kdbus/globals.h b/libs/kdbinder/kdbus/globals.h index 7cb37bb..a6068f4 100644 --- a/libs/kdbinder/kdbus/globals.h +++ b/libs/kdbinder/kdbus/globals.h @@ -18,13 +18,13 @@ #include <cstdint> -// Use ASSERT for assertions in debug builds. -// Use CHECK for assertions in debug and release builds. -// Use STATIC_ASSERT for compile time assertions. -#define ASSERT(cond) assert(cond) +// Use KDBUS_ASSERT for assertions in debug builds. +// Use KDBUS_CHECK for assertions in debug and release builds. +// Use KDBUS_STATIC_ASSERT for compile time assertions. +#define KDBUS_ASSERT(cond) assert(cond) // TODO: Use LOGCAT -#define CHECK(cond) if(!(cond)) std::terminate() -#define STATIC_ASSERT(cond) static_assert(cond, "") +#define KDBUS_CHECK(cond) if(!(cond)) std::terminate() +#define KDBUS_STATIC_ASSERT(cond) static_assert(cond, "") namespace android { namespace kdbus { @@ -32,7 +32,7 @@ namespace kdbus { const uint64_t kAlignment = 8; constexpr uint64_t kAlignTo8Bit(uint64_t s) { - STATIC_ASSERT(kAlignment == 8); + KDBUS_STATIC_ASSERT(kAlignment == 8); // - Increment s to make sure we will not round it down when aligning. // - Clear the least significant bits. diff --git a/libs/kdbinder/kdbus/item.cpp b/libs/kdbinder/kdbus/item.cpp index a5aed1e..18e0bc2 100644 --- a/libs/kdbinder/kdbus/item.cpp +++ b/libs/kdbinder/kdbus/item.cpp @@ -56,7 +56,7 @@ struct kdbus_item* ItemBloomParameter::Queue(struct kdbus_item *item) const { ItemStr::ItemStr(const std::string& str) : Item(Item::kComputeSize(strlen(str.c_str()) + 1)) { - CHECK(strlen(str.c_str()) <= sizeof(str_)); + KDBUS_CHECK(strlen(str.c_str()) <= sizeof(str_)); snprintf(str_, sizeof(str_), "%s", str.c_str()); } |