From e2359d9a4ed9d27139346aa045c784db04d15776 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 25 Mar 2005 06:01:34 +0000 Subject: Fixes for GCC3.4 and namespaces (must rerun configure!) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@902 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/commands.cpp | 51 +++++++++++++++++++++++++++++---------------------- src/inspircd.cpp | 51 +++++++++++++++++++++++++++++---------------------- src/modules.cpp | 52 +++++++++++++++++++++++++++++----------------------- src/xline.cpp | 9 ++++++++- 4 files changed, 95 insertions(+), 68 deletions(-) diff --git a/src/commands.cpp b/src/commands.cpp index b149da7e8..0173f9113 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -116,28 +116,35 @@ const long duration_y = duration_w * 52; namespace nspace { - template<> struct nspace::hash - { - size_t operator()(const struct in_addr &a) const - { - size_t q; - memcpy(&q,&a,sizeof(size_t)); - return q; - } - }; - - template<> struct nspace::hash - { - size_t operator()(const string &s) const - { - char a[MAXBUF]; - static struct hash strhash; - strlcpy(a,s.c_str(),MAXBUF); - strlower(a); - return strhash(a); - } - }; -} +#ifdef GCC34 + template<> struct hash +#else + template<> struct nspace::hash +#endif + { + size_t operator()(const struct in_addr &a) const + { + size_t q; + memcpy(&q,&a,sizeof(size_t)); + return q; + } + }; +#ifdef GCC34 + template<> struct hash +#else + template<> struct nspace::hash +#endif + { + size_t operator()(const string &s) const + { + char a[MAXBUF]; + static struct hash strhash; + strlcpy(a,s.c_str(),MAXBUF); + strlower(a); + return strhash(a); + } + }; +} struct StrHashComp diff --git a/src/inspircd.cpp b/src/inspircd.cpp index a9ef0e341..ecfbd6b0f 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -100,28 +100,35 @@ bool nofork = false; namespace nspace { - template<> struct nspace::hash - { - size_t operator()(const struct in_addr &a) const - { - size_t q; - memcpy(&q,&a,sizeof(size_t)); - return q; - } - }; - - template<> struct nspace::hash - { - size_t operator()(const string &s) const - { - char a[MAXBUF]; - static struct hash strhash; - strlcpy(a,s.c_str(),MAXBUF); - strlower(a); - return strhash(a); - } - }; -} +#ifdef GCC34 + template<> struct hash +#else + template<> struct nspace::hash +#endif + { + size_t operator()(const struct in_addr &a) const + { + size_t q; + memcpy(&q,&a,sizeof(size_t)); + return q; + } + }; +#ifdef GCC34 + template<> struct hash +#else + template<> struct nspace::hash +#endif + { + size_t operator()(const string &s) const + { + char a[MAXBUF]; + static struct hash strhash; + strlcpy(a,s.c_str(),MAXBUF); + strlower(a); + return strhash(a); + } + }; +} struct StrHashComp diff --git a/src/modules.cpp b/src/modules.cpp index d5288d371..7f3603fb7 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -107,29 +107,35 @@ extern FILE *log_file; namespace nspace { - template<> struct nspace::hash - { - size_t operator()(const struct in_addr &a) const - { - size_t q; - memcpy(&q,&a,sizeof(size_t)); - return q; - } - }; - - template<> struct nspace::hash - { - size_t operator()(const string &s) const - { - char a[MAXBUF]; - static struct hash strhash; - strlcpy(a,s.c_str(),MAXBUF); - strlower(a); - return strhash(a); - } - }; -} - +#ifdef GCC34 + template<> struct hash +#else + template<> struct nspace::hash +#endif + { + size_t operator()(const struct in_addr &a) const + { + size_t q; + memcpy(&q,&a,sizeof(size_t)); + return q; + } + }; +#ifdef GCC34 + template<> struct hash +#else + template<> struct nspace::hash +#endif + { + size_t operator()(const string &s) const + { + char a[MAXBUF]; + static struct hash strhash; + strlcpy(a,s.c_str(),MAXBUF); + strlower(a); + return strhash(a); + } + }; +} struct StrHashComp { diff --git a/src/xline.cpp b/src/xline.cpp index 064903ba1..5559390e7 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -105,7 +105,11 @@ extern FILE *log_file; namespace nspace { +#ifdef GCC34 + template<> struct hash +#else template<> struct nspace::hash +#endif { size_t operator()(const struct in_addr &a) const { @@ -114,8 +118,11 @@ namespace nspace return q; } }; - +#ifdef GCC34 + template<> struct hash +#else template<> struct nspace::hash +#endif { size_t operator()(const string &s) const { -- cgit v1.2.3