]> git.ipfire.org Git - thirdparty/squid.git/blob - src/esi/Module.cc
16d1bc9aa2afca16472a8f657b8eec664ea67b44
[thirdparty/squid.git] / src / esi / Module.cc
1 #include "squid-old.h"
2 #include "esi/Module.h"
3 #include "esi/CustomParser.h"
4 #include "esi/Libxml2Parser.h"
5 #include "esi/ExpatParser.h" /* must follow esi/Libxml2Parser.h */
6
7 static ESIParser::Register *prCustom = 0;
8 #if HAVE_LIBXML2
9 static ESIParser::Register *prLibxml = 0;
10 #endif
11 #if HAVE_LIBEXPAT
12 static ESIParser::Register *prExpat = 0;
13 #endif
14
15 void Esi::Init()
16 {
17 assert(!prCustom); // we should be called once
18
19 prCustom = new ESIParser::Register("custom", &ESICustomParser::NewParser);
20
21 #if HAVE_LIBXML2
22 prLibxml = new ESIParser::Register("libxml2", &ESILibxml2Parser::NewParser);
23 #endif
24
25 #if HAVE_LIBEXPAT
26 prExpat = new ESIParser::Register("expat", &ESIExpatParser::NewParser);
27 #endif
28 }
29
30 void Esi::Clean()
31 {
32 assert(prCustom); // we should be called once, and only after Init()
33
34 #if HAVE_LIBEXPAT
35 delete prExpat;
36 prExpat = NULL;
37 #endif
38
39 #if HAVE_LIBXML2
40 delete prLibxml;
41 prLibxml = NULL;
42 #endif
43
44 delete prCustom;
45 prCustom = NULL;
46 }