]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
5b74111a | 2 | * Copyright (C) 1996-2018 The Squid Software Foundation and contributors |
bbc27441 AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
582c2af2 | 9 | #include "squid.h" |
9cee61d8 AR |
10 | #include "esi/CustomParser.h" |
11 | #include "esi/Libxml2Parser.h" | |
602d9612 | 12 | #include "esi/Module.h" |
3d41e53a FC |
13 | /* include for esi/ExpatParser.h must follow esi/Libxml2Parser.h */ |
14 | /* do not remove this comment, as it acts as barrier for the autmatic sorting */ | |
25f78331 | 15 | #include "esi/ExpatParser.h" |
9cee61d8 AR |
16 | |
17 | static ESIParser::Register *prCustom = 0; | |
23df48fd | 18 | #if HAVE_LIBXML2 |
9cee61d8 | 19 | static ESIParser::Register *prLibxml = 0; |
23df48fd HN |
20 | #endif |
21 | #if HAVE_LIBEXPAT | |
9cee61d8 | 22 | static ESIParser::Register *prExpat = 0; |
23df48fd | 23 | #endif |
9cee61d8 | 24 | |
af6a12ee AJ |
25 | void Esi::Init() |
26 | { | |
9cee61d8 | 27 | assert(!prCustom); // we should be called once |
5bc66b10 | 28 | |
9cee61d8 | 29 | prCustom = new ESIParser::Register("custom", &ESICustomParser::NewParser); |
23df48fd HN |
30 | |
31 | #if HAVE_LIBXML2 | |
9cee61d8 | 32 | prLibxml = new ESIParser::Register("libxml2", &ESILibxml2Parser::NewParser); |
23df48fd HN |
33 | #endif |
34 | ||
35 | #if HAVE_LIBEXPAT | |
9cee61d8 | 36 | prExpat = new ESIParser::Register("expat", &ESIExpatParser::NewParser); |
23df48fd | 37 | #endif |
9cee61d8 AR |
38 | } |
39 | ||
af6a12ee AJ |
40 | void Esi::Clean() |
41 | { | |
9cee61d8 AR |
42 | assert(prCustom); // we should be called once, and only after Init() |
43 | ||
23df48fd | 44 | #if HAVE_LIBEXPAT |
9cee61d8 | 45 | delete prExpat; |
9cee61d8 | 46 | prExpat = NULL; |
23df48fd HN |
47 | #endif |
48 | ||
49 | #if HAVE_LIBXML2 | |
50 | delete prLibxml; | |
9cee61d8 | 51 | prLibxml = NULL; |
23df48fd HN |
52 | #endif |
53 | ||
54 | delete prCustom; | |
9cee61d8 AR |
55 | prCustom = NULL; |
56 | } | |
f53969cc | 57 |