Permalink
Browse files

Switched encoding generators to singletons.

  • Loading branch information...
1 parent f122306 commit 6685f014ab0a9b33ff8454efea01b35998e211e9 Dmitry Prokoptsev committed Feb 17, 2014
Showing with 11 additions and 6 deletions.
  1. +11 −6 pire/encoding.cpp
View
@@ -71,8 +71,6 @@ namespace {
ypair<size_t, size_t> Next(0x80, 0xC0);
}
-static const Latin1 latin1;
-
class Utf8: public Encoding {
public:
@@ -112,14 +110,21 @@ static const Latin1 latin1;
fsm.SetIsDetermined(false);
}
};
-
-static const Utf8 utf8;
}
namespace Encodings {
- const Encoding& Utf8() { return utf8; }
- const Encoding& Latin1() { return latin1; }
+ const Encoding& Utf8()
+ {
+ static const Pire::Utf8 utf8;
+ return utf8;
+ }
+
+ const Encoding& Latin1()
+ {
+ static const Pire::Latin1 latin1;
+ return latin1;
+ }
}

0 comments on commit 6685f01

Please sign in to comment.