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

Remove static variables from functions in modules which causes them to be marked as gnu unique objects, which breaks dlclose()/dlopen() on g++ 4.5+

This commit is contained in:
Adam
2013-09-16 06:28:48 -04:00
parent 8cbaf7e990
commit e3c05efe5e
7 changed files with 74 additions and 59 deletions
+22 -22
View File
@@ -3,6 +3,28 @@
#include "modules/xmlrpc.h"
#include "modules/httpd.h"
static struct special_chars
{
Anope::string character;
Anope::string replace;
special_chars(const Anope::string &c, const Anope::string &r) : character(c), replace(r) { }
}
special[] = {
special_chars("&", "&"),
special_chars("\"", """),
special_chars("<", "&lt;"),
special_chars(">", "&qt;"),
special_chars("'", "&#39;"),
special_chars("\n", "&#xA;"),
special_chars("\002", ""), // bold
special_chars("\003", ""), // color
special_chars("\035", ""), // italics
special_chars("\037", ""), // underline
special_chars("\026", ""), // reverses
special_chars("", "")
};
class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage
{
std::deque<XMLRPCEvent *> events;
@@ -25,28 +47,6 @@ class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage
Anope::string Sanitize(const Anope::string &string) anope_override
{
static struct special_chars
{
Anope::string character;
Anope::string replace;
special_chars(const Anope::string &c, const Anope::string &r) : character(c), replace(r) { }
}
special[] = {
special_chars("&", "&amp;"),
special_chars("\"", "&quot;"),
special_chars("<", "&lt;"),
special_chars(">", "&qt;"),
special_chars("'", "&#39;"),
special_chars("\n", "&#xA;"),
special_chars("\002", ""), // bold
special_chars("\003", ""), // color
special_chars("\035", ""), // italics
special_chars("\037", ""), // underline
special_chars("\026", ""), // reverses
special_chars("", "")
};
Anope::string ret = string;
for (int i = 0; special[i].character.empty() == false; ++i)
ret = ret.replace_all_cs(special[i].character, special[i].replace);