mirror of
https://github.com/crosspoint-reader/crosspoint-reader.git
synced 2026-04-29 10:26:52 -07:00
14 lines
391 B
C
14 lines
391 B
C
#pragma once
|
|||
|
|
|
||
|
|
#include <expat.h>
|
||
|
|
|
||
|
|
// Safely tear down an expat parser: stop processing, clear callbacks, free, and null the pointer.
|
||
|
|
inline void destroyXmlParser(XML_Parser& parser) {
|
||
|
|
if (!parser) return;
|
||
|
|
XML_StopParser(parser, XML_FALSE);
|
||
|
|
XML_SetElementHandler(parser, nullptr, nullptr);
|
||
|
|
XML_SetCharacterDataHandler(parser, nullptr);
|
||
|
|
XML_ParserFree(parser);
|
||
|
|
parser = nullptr;
|
||
|
|
}
|