summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-08-30 10:35:21 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-08-30 10:35:21 +0200
commit84ae29d0eadb5baa7ad4f517c3ce62995205d2f5 (patch)
tree49e211e34bf1dbbe18965da43c027dcbd64d9aa9
parent8fc268558586584479c622a3852f647eaf3a9b0e (diff)
Move the intrusive list containers into the insp namespace
-rw-r--r--include/commands/cmd_whowas.h4
-rw-r--r--include/dynref.h2
-rw-r--r--include/intrusive_list.h5
-rw-r--r--include/intrusive_list_impl.h5
-rw-r--r--include/membership.h10
-rw-r--r--include/usermanager.h2
-rw-r--r--include/users.h4
-rw-r--r--src/modules.cpp6
8 files changed, 24 insertions, 14 deletions
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<Nick>
+ struct Nick : public insp::intrusive_list_node<Nick>
{
/** 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<Nick> FIFO;
+ typedef insp::intrusive_list_tail<Nick> 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<dynamic_reference_base>
+class CoreExport dynamic_reference_base : public interfacebase, public insp::intrusive_list_node<dynamic_reference_base>
{
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 <iterator>
+namespace insp
+{
+
struct intrusive_list_def_tag { };
template <typename T, typename Tag = intrusive_list_def_tag> class intrusive_list;
@@ -52,6 +55,8 @@ class intrusive_list_node
friend class intrusive_list_tail<T, Tag>;
};
+} // 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 <typename T, typename Tag>
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<Membership>
+class CoreExport Membership : public Extensible, public insp::intrusive_list_node<Membership>
{
public:
/** Type of the Membership id
@@ -119,7 +119,7 @@ class InviteBase
protected:
/** List of pending Invitations
*/
- intrusive_list<Invitation, T> invites;
+ insp::intrusive_list<Invitation, T> 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<Invitation, Channel>, public intrusive_list_node<Invitation, LocalUser>
+class CoreExport Invitation : public insp::intrusive_list_node<Invitation, Channel>, public insp::intrusive_list_node<Invitation, LocalUser>
{
/** 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<Invitation, Channel>, p
static Invitation* Find(Channel* c, LocalUser* u, bool check_expired = true);
};
-typedef intrusive_list<Invitation, LocalUser> InviteList;
+typedef insp::intrusive_list<Invitation, LocalUser> InviteList;
template<typename T>
inline void InviteBase<T>::ClearInvites()
{
- for (typename intrusive_list<Invitation, T>::iterator i = invites.begin(); i != invites.end(); )
+ for (typename insp::intrusive_list<Invitation, T>::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<UserManager>
/** A list holding local users
*/
- typedef intrusive_list<LocalUser> LocalList;
+ typedef insp::intrusive_list<LocalUser> 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<Membership> ChanList;
+ typedef insp::intrusive_list<Membership> 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<LocalUser>, public intrusive_list_node<LocalUser>
+class CoreExport LocalUser : public User, public InviteBase<LocalUser>, public insp::intrusive_list_node<LocalUser>
{
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 <dirent.h>
#endif
-static intrusive_list<dynamic_reference_base>* dynrefs = NULL;
+static insp::intrusive_list<dynamic_reference_base>* dynrefs = NULL;
void dynamic_reference_base::reset_all()
{
if (!dynrefs)
return;
- for (intrusive_list<dynamic_reference_base>::iterator i = dynrefs->begin(); i != dynrefs->end(); ++i)
+ for (insp::intrusive_list<dynamic_reference_base>::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<dynamic_reference_base>;
+ dynrefs = new insp::intrusive_list<dynamic_reference_base>;
dynrefs->push_front(this);
// Resolve unless there is no ModuleManager (part of class InspIRCd)