// 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 {
namespace common {
Extension* GetCurrentExtension() {
- assert(g_extension);
+ Assert(g_extension);
return g_extension;
}
#define Assert(condition) AssertMsg(condition, "")
-#endif // COMMON_ASSERT_H_
\ No newline at end of file
+#endif // COMMON_ASSERT_H_
#include "common/extension.h"
-#include <assert.h>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#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() {
// 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;
XW_CreatedInstanceCallback created_instance,
XW_ShutdownCallback shutdown) {
LoggerD("Enter");
- assert(extension);
+ Assert(extension);
if (!InitializeInterfaces(get_interface)) {
return XW_ERROR;
Instance::~Instance() {
LoggerD("Enter");
- assert(xw_instance_ == 0);
+ Assert(xw_instance_ == 0);
}
void Instance::PostMessage(const char* msg) {
#endif
-#include <cassert>
#include <new>
#include <utility>
#include <type_traits>
+#include "common/assert.h"
namespace common {
get()->~T();
}
const T* get() const {
- assert(exist_);
+ Assert(exist_);
return reinterpret_cast<const T*>(value_);
}
T* get() {
- assert(exist_);
+ Assert(exist_);
return reinterpret_cast<T*>(value_);
}
#define picojson_h
#include <algorithm>
-#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <string>
#include <vector>
+#include "common/assert.h"
#ifdef _MSC_VER
#define SNPRINTF _snprintf_s
#define GET(ctype, var) \
template <> inline const ctype& value::get<ctype>() const { \
- assert("type mismatch! call vis<type>() before get<type>()" \
+ Assert("type mismatch! call vis<type>() before get<type>()" \
&& is<ctype>()); \
return var; \
} \
template <> inline ctype& value::get<ctype>() { \
- assert("type mismatch! call is<type>() before get<type>()" \
+ Assert("type mismatch! call is<type>() before get<type>()" \
&& is<ctype>()); \
return var; \
}
inline const value& value::get(size_t idx) const {
static value s_null;
- assert(is<array>());
+ Assert(is<array>());
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<object>());
+ Assert(is<object>());
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<array>());
+ Assert(is<array>());
return idx < u_.array_->size();
}
inline bool value::contains(const std::string& key) const {
- assert(is<object>());
+ Assert(is<object>());
object::const_iterator i = u_.object_->find(key);
return i != u_.object_->end();
}
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
}
void ungetc() {
if (last_ch_ != -1) {
- assert(! ungot_);
+ Assert(! ungot_);
ungot_ = true;
}
}
PICOJSON_CMP(array);
PICOJSON_CMP(object);
#undef PICOJSON_CMP
- assert(0);
+ Assert(0);
#ifdef _MSC_VER
__assume(0);
#endif