diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-18 16:01:33 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-18 16:01:33 +0000 |
commit | a59d08fffd3dc8a9850ce34c9928fb6382b9b37f (patch) | |
tree | 1d5debd7915dddc122feec50443f42d535cba311 /include | |
parent | da6e45397e4ee86d6caf86d2fd5fd8f77af48a1e (diff) |
Remove VF_SERVICEPROVIDER, prevent heap allocation of ConfigReader
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11904 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/bancache.h | 4 | ||||
-rw-r--r-- | include/base.h | 14 | ||||
-rw-r--r-- | include/command_parse.h | 2 | ||||
-rw-r--r-- | include/commands/cmd_whowas.h | 4 | ||||
-rw-r--r-- | include/configreader.h | 2 | ||||
-rw-r--r-- | include/modules.h | 25 | ||||
-rw-r--r-- | include/xline.h | 4 |
7 files changed, 34 insertions, 21 deletions
diff --git a/include/bancache.h b/include/bancache.h index c9c469e4f..952a1453a 100644 --- a/include/bancache.h +++ b/include/bancache.h @@ -21,7 +21,7 @@ * entries expire every few hours, which is a reasonable expiry for any reasonable * sized network. */ -class CoreExport BanCacheHit : public classbase +class CoreExport BanCacheHit { public: /** Type of cached ban @@ -66,7 +66,7 @@ typedef nspace::hash_map<std::string, BanCacheHit*, nspace::hash<std::string> > /** A manager for ban cache, which allocates and deallocates and checks cached bans. */ -class CoreExport BanCacheManager : public classbase +class CoreExport BanCacheManager { private: BanCacheHash* BanHash; diff --git a/include/base.h b/include/base.h index 624e2174f..856cd64c2 100644 --- a/include/base.h +++ b/include/base.h @@ -47,6 +47,20 @@ class CoreExport classbase void operator=(const classbase&); }; +/** The base class for inspircd classes that provide a wrapping interface, and + * should only exist while being used. Prevents heap allocation. + */ +class CoreExport interfacebase +{ + public: + interfacebase() {} + private: + interfacebase(const interfacebase&); + void operator=(const interfacebase&); + void* operator new(size_t); + void operator delete(void*); +}; + /** The base class for inspircd classes that support reference counting. * Any objects that do not have a well-defined lifetime should inherit from * this, and should be assigned to a reference<type> object to establish their diff --git a/include/command_parse.h b/include/command_parse.h index 35f5a7b0e..814cdb27a 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -23,7 +23,7 @@ typedef std::map<std::string, void*> SharedObjectList; * call command handlers by name, and chop up comma seperated * parameters into multiple calls. */ -class CoreExport CommandParser : public classbase +class CoreExport CommandParser { private: /** Parameter buffer diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h index 12c9eae9a..71c635b39 100644 --- a/include/commands/cmd_whowas.h +++ b/include/commands/cmd_whowas.h @@ -94,7 +94,7 @@ class CommandWhowas : public Command /** Used to hold WHOWAS information */ -class WhoWasGroup : public classbase +class WhoWasGroup { public: /** Real host @@ -116,7 +116,7 @@ class WhoWasGroup : public classbase */ time_t signon; - /** Initialize this WhoQasFroup with a user + /** Initialize this WhoWasFroup with a user */ WhoWasGroup(User* user); /** Destructor diff --git a/include/configreader.h b/include/configreader.h index 553f49d60..402f984e8 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -117,7 +117,7 @@ class ServerLimits * and storage of the configuration data needed to run the ircd, such as * the servername, connect classes, /ADMIN data, MOTDs and filenames etc. */ -class CoreExport ServerConfig : public classbase +class CoreExport ServerConfig { private: void CrossCheckOperClassType(); diff --git a/include/modules.h b/include/modules.h index 96506f598..ad9cf05b8 100644 --- a/include/modules.h +++ b/include/modules.h @@ -33,10 +33,9 @@ enum ModuleFlags { VF_NONE = 0, // module is not special at all VF_STATIC = 1, // module is static, cannot be /unloadmodule'd VF_VENDOR = 2, // module is a vendor module (came in the original tarball, not 3rd party) - VF_SERVICEPROVIDER = 4, // module provides a service to other modules (can be a dependency) - VF_COMMON = 8, // module needs to be common on all servers in a network to link - VF_OPTCOMMON = 16, // module should be common on all servers for unsurprising behavior - VF_CORE = 32 // module is a core command, can be assumed loaded on all servers + VF_COMMON = 4, // module needs to be common on all servers in a network to link + VF_OPTCOMMON = 8, // module should be common on all servers for unsurprising behavior + VF_CORE = 16 // module is a core command, can be assumed loaded on all servers }; /** Used with SendToMode() @@ -74,26 +73,26 @@ struct ModResult { int res; ModResult() : res(0) {} explicit ModResult(int r) : res(r) {} - bool operator==(const ModResult& r) const + inline bool operator==(const ModResult& r) const { return res == r.res; } - bool operator!=(const ModResult& r) const + inline bool operator!=(const ModResult& r) const { return res != r.res; } - bool operator!() const + inline bool operator!() const { return !res; } - bool check(bool def) const + inline bool check(bool def) const { return (res == 1 || (res == 0 && def)); } /** * Merges two results, preferring ALLOW to DENY */ - ModResult operator+(const ModResult& r) const + inline ModResult operator+(const ModResult& r) const { if (res == r.res || r.res == 0) return *this; @@ -107,7 +106,7 @@ struct ModResult { /** If you change the module API in any way, increment this value. * This MUST be a pure integer, with no parenthesis */ -#define API_VERSION 134 +#define API_VERSION 135 class ServerConfig; @@ -314,7 +313,7 @@ class CoreExport Event : public classbase void Send(); }; -/** Priority types which can be returned from Module::Prioritize() +/** Priority types which can be used by Module::Prioritize() */ enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFORE, PRIORITY_AFTER }; @@ -1297,7 +1296,7 @@ class CoreExport Module : public classbase * Constructing the class using one parameter allows you to specify a path to your own configuration * file, otherwise, inspircd.conf is read. */ -class CoreExport ConfigReader : public classbase +class CoreExport ConfigReader : public interfacebase { protected: /** Error code @@ -1461,7 +1460,7 @@ typedef IntModuleList::iterator EventHandlerIter; /** ModuleManager takes care of all things module-related * in the core. */ -class CoreExport ModuleManager : public classbase +class CoreExport ModuleManager { private: /** Holds a string describing the last module error to occur diff --git a/include/xline.h b/include/xline.h index 7ac4aa7f1..e349c28d7 100644 --- a/include/xline.h +++ b/include/xline.h @@ -366,7 +366,7 @@ typedef std::pair<std::string, std::string> IdentHostPair; * does not have to know the specifics of the internals of an XLine class * and/or how to call its constructor. */ -class CoreExport XLineFactory : public classbase +class CoreExport XLineFactory { protected: @@ -436,7 +436,7 @@ typedef XLineLookup::iterator LookupIter; * or any other line created by a module. It also manages XLineFactory classes which * can generate a specialized XLine for use by another module. */ -class CoreExport XLineManager : public classbase +class CoreExport XLineManager { protected: /** Used to hold XLines which have not yet been applied. |