Document migration plan from CrossPoint's lib/Epub to FreeInkBook, a memory-efficient clean-room EPUB engine. Covers advantages (O(paragraph+page) memory via SAX parsing, arena allocation, host-testable, full UAX#14 typography, runtime TTF/OTF support), 9-step migration strategy, ESP32-C3 constraints, and integration approach preserving existing UI layer while replacing parsing/layout stack.
14 lines
429 B
C
14 lines
429 B
C
#pragma once
|
|
|
|
#include <epub/Expat.h> // FreeInkBook's vendored expat
|
|
|
|
// 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;
|
|
}
|