From: Andrzej Popowski Date: Mon, 6 Jul 2015 09:48:11 +0000 (+0200) Subject: [Common] - Removing the macro assert() X-Git-Tag: submit/tizen/20150702.103311^2~1^2~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07e9dad24c30c7f84c18810c1a889c03b9a9319f;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Common] - Removing the macro assert() Change-Id: Ia54a60da44b290ff186d293ccb8d467b53793ffc Signed-off-by: Andrzej Popowski --- diff --git a/src/common/XW_Extension.cc b/src/common/XW_Extension.cc index f85beb7e..b23e455c 100755 --- a/src/common/XW_Extension.cc +++ b/src/common/XW_Extension.cc @@ -6,6 +6,7 @@ // This file is compiled into each plugin, hence its size should be minimized. #include "common/extension.h" +#include "common/assert.h" #include "common/logger.h" namespace { @@ -17,7 +18,7 @@ common::Extension* g_extension = nullptr; namespace common { Extension* GetCurrentExtension() { - assert(g_extension); + Assert(g_extension); return g_extension; } diff --git a/src/common/assert.h b/src/common/assert.h index fb07d4fc..1e0fd39d 100755 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -32,4 +32,4 @@ #define Assert(condition) AssertMsg(condition, "") -#endif // COMMON_ASSERT_H_ \ No newline at end of file +#endif // COMMON_ASSERT_H_ diff --git a/src/common/extension.cc b/src/common/extension.cc index c47986db..b0339312 100755 --- a/src/common/extension.cc +++ b/src/common/extension.cc @@ -5,13 +5,13 @@ #include "common/extension.h" -#include #include #include #include #include #include "common/logger.h" +#include "common/assert.h" // This function is hidden, because each plugin needs to have own implementation. __attribute__ ((visibility ("hidden"))) common::Extension* CreateExtension() { @@ -150,7 +150,7 @@ std::string Extension::GetRuntimeVariable(const char* var_name, unsigned len) { // static void Extension::OnInstanceCreated(XW_Instance xw_instance, Instance* instance) { LoggerD("Enter"); - assert(!g_core->GetInstanceData(xw_instance)); + Assert(!g_core->GetInstanceData(xw_instance)); if (!instance) return; instance->xw_instance_ = xw_instance; @@ -196,7 +196,7 @@ int32_t Extension::XW_Initialize(XW_Extension extension, XW_CreatedInstanceCallback created_instance, XW_ShutdownCallback shutdown) { LoggerD("Enter"); - assert(extension); + Assert(extension); if (!InitializeInterfaces(get_interface)) { return XW_ERROR; @@ -228,7 +228,7 @@ Instance::Instance() : Instance::~Instance() { LoggerD("Enter"); - assert(xw_instance_ == 0); + Assert(xw_instance_ == 0); } void Instance::PostMessage(const char* msg) { diff --git a/src/common/optional.h b/src/common/optional.h index ba467c30..232a7456 100755 --- a/src/common/optional.h +++ b/src/common/optional.h @@ -26,10 +26,10 @@ #endif -#include #include #include #include +#include "common/assert.h" namespace common { @@ -75,12 +75,12 @@ class optional { get()->~T(); } const T* get() const { - assert(exist_); + Assert(exist_); return reinterpret_cast(value_); } T* get() { - assert(exist_); + Assert(exist_); return reinterpret_cast(value_); } diff --git a/src/common/picojson.h b/src/common/picojson.h index 9f983197..6921b1f1 100644 --- a/src/common/picojson.h +++ b/src/common/picojson.h @@ -31,7 +31,6 @@ #define picojson_h #include -#include #include #include #include @@ -41,6 +40,7 @@ #include #include #include +#include "common/assert.h" #ifdef _MSC_VER #define SNPRINTF _snprintf_s @@ -204,12 +204,12 @@ namespace picojson { #define GET(ctype, var) \ template <> inline const ctype& value::get() const { \ - assert("type mismatch! call vis() before get()" \ + Assert("type mismatch! call vis() before get()" \ && is()); \ return var; \ } \ template <> inline ctype& value::get() { \ - assert("type mismatch! call is() before get()" \ + Assert("type mismatch! call is() before get()" \ && is()); \ return var; \ } @@ -237,24 +237,24 @@ namespace picojson { inline const value& value::get(size_t idx) const { static value s_null; - assert(is()); + Assert(is()); return idx < u_.array_->size() ? (*u_.array_)[idx] : s_null; } inline const value& value::get(const std::string& key) const { static value s_null; - assert(is()); + Assert(is()); object::const_iterator i = u_.object_->find(key); return i != u_.object_->end() ? i->second : s_null; } inline bool value::contains(size_t idx) const { - assert(is()); + Assert(is()); return idx < u_.array_->size(); } inline bool value::contains(const std::string& key) const { - assert(is()); + Assert(is()); object::const_iterator i = u_.object_->find(key); return i != u_.object_->end(); } @@ -272,7 +272,7 @@ namespace picojson { case string_type: return *u_.string_; case array_type: return "array"; case object_type: return "object"; - default: assert(0); + default: Assert(0); #ifdef _MSC_VER __assume(0); #endif @@ -382,7 +382,7 @@ namespace picojson { } void ungetc() { if (last_ch_ != -1) { - assert(! ungot_); + Assert(! ungot_); ungot_ = true; } } @@ -760,7 +760,7 @@ namespace picojson { PICOJSON_CMP(array); PICOJSON_CMP(object); #undef PICOJSON_CMP - assert(0); + Assert(0); #ifdef _MSC_VER __assume(0); #endif