lib: Allow test suite to access raw accounting values

This commit is contained in:
Sebastian Pipping 2021-04-19 21:44:38 +02:00
parent fcd0e14c3e
commit 8af7d22ff0
2 changed files with 21 additions and 0 deletions

View file

@ -139,6 +139,8 @@
8388608 // 8 MiB, 2^23
/* NOTE END */
#include "expat.h" // so we can use type XML_Parser below
#ifdef __cplusplus
extern "C" {
#endif
@ -146,6 +148,11 @@ extern "C" {
void _INTERNAL_trim_to_complete_utf8_characters(const char *from,
const char **fromLimRef);
#if defined(XML_DTD)
unsigned long long testingAccountingGetCountBytesDirect(XML_Parser parser);
unsigned long long testingAccountingGetCountBytesIndirect(XML_Parser parser);
#endif
#ifdef __cplusplus
}
#endif

View file

@ -7357,6 +7357,20 @@ accountingDiffTolerated(XML_Parser originParser, int tok, const char *before,
return tolerated;
}
unsigned long long
testingAccountingGetCountBytesDirect(XML_Parser parser) {
if (! parser)
return 0;
return parser->m_accounting.countBytesDirect;
}
unsigned long long
testingAccountingGetCountBytesIndirect(XML_Parser parser) {
if (! parser)
return 0;
return parser->m_accounting.countBytesIndirect;
}
static void
entityTrackingReportStats(XML_Parser rootParser, ENTITY *entity,
const char *action, int sourceLine) {