1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 15:03:12 +02:00

Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9

This commit is contained in:
Naram Qashat
2010-07-28 00:28:59 -04:00
51 changed files with 149 additions and 88 deletions
+3 -3
View File
@@ -153,7 +153,7 @@ class CoreExport Extensible
if (it != this->Extension_Items.end())
{
p = dynamic_cast<ExtensibleItemRegular<T> *>(it->second)->GetItem();
p = debug_cast<ExtensibleItemRegular<T> *>(it->second)->GetItem();
return true;
}
@@ -172,7 +172,7 @@ class CoreExport Extensible
if (it != this->Extension_Items.end())
{
p = dynamic_cast<ExtensibleItemPointer<T> *>(it->second)->GetItem();
p = debug_cast<ExtensibleItemPointer<T> *>(it->second)->GetItem();
return true;
}
@@ -192,7 +192,7 @@ class CoreExport Extensible
if (it != this->Extension_Items.end())
{
p = dynamic_cast<ExtensibleItemPointerArray<T> *>(it->second)->GetItem();
p = debug_cast<ExtensibleItemPointerArray<T> *>(it->second)->GetItem();
return true;
}
+17 -1
View File
@@ -39,8 +39,8 @@
#include <sys/stat.h> /* for umask() on some systems */
#include <sys/types.h>
#include <assert.h>
#include <fcntl.h>
#include <typeinfo>
#ifndef _WIN32
# include <unistd.h>
@@ -268,6 +268,22 @@ class DatabaseException : public CoreException
virtual ~DatabaseException() throw() { }
};
/** Debug cast to be used instead of dynamic_cast, this uses dynamic_cast
* for debug builds and static_cast on releass builds to speed up the program
* because dynamic_cast relies on RTTI.
*/
template<typename T, typename O> inline T debug_cast(O ptr)
{
#ifdef DEBUG_BUILD
T ret = dynamic_cast<T>(ptr);
if (ret == NULL)
throw CoreException(Anope::string("debug_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail");
return ret;
#else
return static_cast<T>(ptr);
#endif
}
/*************************************************************************/
/** Class with the ability to keep flags on items, they should extend from this
+2
View File
@@ -1,6 +1,8 @@
#ifndef _SYSCONF_H_
#define _SYSCONF_H_
#cmakedefine DEBUG_BUILD
#cmakedefine DEFUMASK @DEFUMASK@
#cmakedefine HAVE_SYS_TYPES_H 1
#cmakedefine HAVE_STDINT_H 1