--- a/src/internfile/myhtmlparse.cpp
+++ b/src/internfile/myhtmlparse.cpp
@@ -34,8 +34,6 @@
#include "cancelcheck.h"
#include "debuglog.h"
#include "transcode.h"
-
-map<string, string> MyHtmlParser::my_named_ents;
inline static bool
p_notdigit(char c)
@@ -151,6 +149,25 @@
"rsaquo", "\xe2\x80\xba", "euro", "\xe2\x82\xac",
NULL, NULL
};
+map<string, string> my_named_ents;
+class NamedEntsInitializer {
+public:
+ NamedEntsInitializer()
+ {
+ for (int i = 0;;) {
+ const char *ent;
+ const char *val;
+ ent = epairs[i++];
+ if (ent == 0)
+ break;
+ val = epairs[i++];
+ if (val == 0)
+ break;
+ my_named_ents[string(ent)] = val;
+ }
+ }
+};
+static NamedEntsInitializer namedEntsInitializerInstance;
MyHtmlParser::MyHtmlParser()
: in_script_tag(false),
@@ -163,20 +180,6 @@
// The default html document charset is iso-8859-1. We'll update
// this value from the encoding tag if found.
charset = "iso-8859-1";
-
- if (my_named_ents.empty()) {
- for (int i = 0;;) {
- const char *ent;
- const char *val;
- ent = epairs[i++];
- if (ent == 0)
- break;
- val = epairs[i++];
- if (val == 0)
- break;
- my_named_ents[string(ent)] = val;
- }
- }
}
void MyHtmlParser::decode_entities(string &s)