From: Attila Molnar Date: Sat, 30 Aug 2014 08:35:21 +0000 (+0200) Subject: Move the intrusive list containers into the insp namespace X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=84ae29d0eadb5baa7ad4f517c3ce62995205d2f5;p=user%2Fhenk%2Fcode%2Finspircd.git Move the intrusive list containers into the insp namespace --- diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h index d443f172b..cd2101e9f 100644 --- a/include/commands/cmd_whowas.h +++ b/include/commands/cmd_whowas.h @@ -60,7 +60,7 @@ namespace WhoWas /** Everything known about one nick */ - struct Nick : public intrusive_list_node + struct Nick : public insp::intrusive_list_node { /** A group of users related by nickname */ @@ -142,7 +142,7 @@ namespace WhoWas private: /** Order in which the users were added into the map, used to remove oldest nick */ - typedef intrusive_list_tail FIFO; + typedef insp::intrusive_list_tail FIFO; /** Sets of users in the whowas system */ diff --git a/include/dynref.h b/include/dynref.h index 02474b67e..a3d2f9966 100644 --- a/include/dynref.h +++ b/include/dynref.h @@ -22,7 +22,7 @@ #include "base.h" -class CoreExport dynamic_reference_base : public interfacebase, public intrusive_list_node +class CoreExport dynamic_reference_base : public interfacebase, public insp::intrusive_list_node { private: std::string name; diff --git a/include/intrusive_list.h b/include/intrusive_list.h index 88f3c6829..de013ae38 100644 --- a/include/intrusive_list.h +++ b/include/intrusive_list.h @@ -21,6 +21,9 @@ #include +namespace insp +{ + struct intrusive_list_def_tag { }; template class intrusive_list; @@ -52,6 +55,8 @@ class intrusive_list_node friend class intrusive_list_tail; }; +} // namespace insp + // Intrusive list where the list only has a pointer to the head element #define INSPIRCD_INTRUSIVE_LIST_NAME intrusive_list #include "intrusive_list_impl.h" diff --git a/include/intrusive_list_impl.h b/include/intrusive_list_impl.h index 0efe06d2e..1dd36b03a 100644 --- a/include/intrusive_list_impl.h +++ b/include/intrusive_list_impl.h @@ -17,6 +17,9 @@ */ +namespace insp +{ + template class INSPIRCD_INTRUSIVE_LIST_NAME { @@ -165,3 +168,5 @@ class INSPIRCD_INTRUSIVE_LIST_NAME #endif size_t listsize; }; + +} // namespace insp diff --git a/include/membership.h b/include/membership.h index 71008e46b..11c142912 100644 --- a/include/membership.h +++ b/include/membership.h @@ -29,7 +29,7 @@ uint64_t ConvToUInt64(const std::string& in); * All prefix modes a member has is tracked by this object. Moreover, Memberships are Extensibles * meaning modules can add arbitrary data to them using extensions (see m_delaymsg for an example). */ -class CoreExport Membership : public Extensible, public intrusive_list_node +class CoreExport Membership : public Extensible, public insp::intrusive_list_node { public: /** Type of the Membership id @@ -119,7 +119,7 @@ class InviteBase protected: /** List of pending Invitations */ - intrusive_list invites; + insp::intrusive_list invites; public: /** Remove and destruct all pending invitations this user or channel has. @@ -134,7 +134,7 @@ class InviteBase * The Invitation class contains all data about a pending invitation. * Invitation objects are referenced from the user and the channel they belong to. */ -class CoreExport Invitation : public intrusive_list_node, public intrusive_list_node +class CoreExport Invitation : public insp::intrusive_list_node, public insp::intrusive_list_node { /** Constructs an Invitation, only called by Create() * @param c Channel the user is invited to @@ -182,12 +182,12 @@ class CoreExport Invitation : public intrusive_list_node, p static Invitation* Find(Channel* c, LocalUser* u, bool check_expired = true); }; -typedef intrusive_list InviteList; +typedef insp::intrusive_list InviteList; template inline void InviteBase::ClearInvites() { - for (typename intrusive_list::iterator i = invites.begin(); i != invites.end(); ) + for (typename insp::intrusive_list::iterator i = invites.begin(); i != invites.end(); ) { Invitation* inv = *i; // Destructing the Invitation invalidates the iterator, so move it now diff --git a/include/usermanager.h b/include/usermanager.h index 361584cda..3671e8907 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -41,7 +41,7 @@ class CoreExport UserManager : public fakederef /** A list holding local users */ - typedef intrusive_list LocalList; + typedef insp::intrusive_list LocalList; private: /** Map of IP addresses for clone counting diff --git a/include/users.h b/include/users.h index 8c89a0b16..ceee4396b 100644 --- a/include/users.h +++ b/include/users.h @@ -250,7 +250,7 @@ class CoreExport User : public Extensible public: /** List of Memberships for this user */ - typedef intrusive_list ChanList; + typedef insp::intrusive_list ChanList; /** Hostname of connection. * This should be valid as per RFC1035. @@ -625,7 +625,7 @@ class CoreExport UserIOHandler : public StreamSocket typedef unsigned int already_sent_t; -class CoreExport LocalUser : public User, public InviteBase, public intrusive_list_node +class CoreExport LocalUser : public User, public InviteBase, public insp::intrusive_list_node { public: LocalUser(int fd, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server); diff --git a/src/modules.cpp b/src/modules.cpp index 42a9e8010..cb5b9c32c 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -32,13 +32,13 @@ #include #endif -static intrusive_list* dynrefs = NULL; +static insp::intrusive_list* dynrefs = NULL; void dynamic_reference_base::reset_all() { if (!dynrefs) return; - for (intrusive_list::iterator i = dynrefs->begin(); i != dynrefs->end(); ++i) + for (insp::intrusive_list::iterator i = dynrefs->begin(); i != dynrefs->end(); ++i) (*i)->resolve(); } @@ -670,7 +670,7 @@ dynamic_reference_base::dynamic_reference_base(Module* Creator, const std::strin : name(Name), value(NULL), creator(Creator) { if (!dynrefs) - dynrefs = new intrusive_list; + dynrefs = new insp::intrusive_list; dynrefs->push_front(this); // Resolve unless there is no ModuleManager (part of class InspIRCd)