]>
Commit | Line | Data |
---|---|---|
582c2af2 | 1 | #include "squid.h" |
9cee61d8 AR |
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; | |
23df48fd | 8 | #if HAVE_LIBXML2 |
9cee61d8 | 9 | static ESIParser::Register *prLibxml = 0; |
23df48fd HN |
10 | #endif |
11 | #if HAVE_LIBEXPAT | |
9cee61d8 | 12 | static ESIParser::Register *prExpat = 0; |
23df48fd | 13 | #endif |
9cee61d8 | 14 | |
af6a12ee AJ |
15 | void Esi::Init() |
16 | { | |
9cee61d8 | 17 | assert(!prCustom); // we should be called once |
5bc66b10 | 18 | |
9cee61d8 | 19 | prCustom = new ESIParser::Register("custom", &ESICustomParser::NewParser); |
23df48fd HN |
20 | |
21 | #if HAVE_LIBXML2 | |
9cee61d8 | 22 | prLibxml = new ESIParser::Register("libxml2", &ESILibxml2Parser::NewParser); |
23df48fd HN |
23 | #endif |
24 | ||
25 | #if HAVE_LIBEXPAT | |
9cee61d8 | 26 | prExpat = new ESIParser::Register("expat", &ESIExpatParser::NewParser); |
23df48fd | 27 | #endif |
9cee61d8 AR |
28 | } |
29 | ||
af6a12ee AJ |
30 | void Esi::Clean() |
31 | { | |
9cee61d8 AR |
32 | assert(prCustom); // we should be called once, and only after Init() |
33 | ||
23df48fd | 34 | #if HAVE_LIBEXPAT |
9cee61d8 | 35 | delete prExpat; |
9cee61d8 | 36 | prExpat = NULL; |
23df48fd HN |
37 | #endif |
38 | ||
39 | #if HAVE_LIBXML2 | |
40 | delete prLibxml; | |
9cee61d8 | 41 | prLibxml = NULL; |
23df48fd HN |
42 | #endif |
43 | ||
44 | delete prCustom; | |
9cee61d8 AR |
45 | prCustom = NULL; |
46 | } |