From d01a4caaa80c0072fe1b6bf073814b9400667fcc Mon Sep 17 00:00:00 2001 From: Brotli Date: Mon, 22 Apr 2024 02:06:42 -0700 Subject: Internal change PiperOrigin-RevId: 626960053 --- c/dec/state.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'c/dec/state.c') diff --git a/c/dec/state.c b/c/dec/state.c index be6a266..edc56c9 100644 --- a/c/dec/state.c +++ b/c/dec/state.c @@ -17,8 +17,24 @@ extern "C" { #endif +#ifdef BROTLI_REPORTING +/* When BROTLI_REPORTING is defined extra reporting module have to be linked. */ +void BrotliDecoderOnStart(const BrotliDecoderState* s); +void BrotliDecoderOnFinish(const BrotliDecoderState* s); +#define BROTLI_DECODER_ON_START(s) BrotliDecoderOnStart(s); +#define BROTLI_DECODER_ON_FINISH(s) BrotliDecoderOnFinish(s); +#else +#if !defined(BROTLI_DECODER_ON_START) +#define BROTLI_DECODER_ON_START(s) (void)(s); +#endif +#if !defined(BROTLI_DECODER_ON_FINISH) +#define BROTLI_DECODER_ON_FINISH(s) (void)(s); +#endif +#endif + BROTLI_BOOL BrotliDecoderStateInit(BrotliDecoderState* s, brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque) { + BROTLI_DECODER_ON_START(s); if (!alloc_func) { s->alloc_func = BrotliDefaultAllocFunc; s->free_func = BrotliDefaultFreeFunc; @@ -135,16 +151,6 @@ void BrotliDecoderStateCleanupAfterMetablock(BrotliDecoderState* s) { BROTLI_DECODER_FREE(s, s->distance_hgroup.htrees); } -#ifdef BROTLI_REPORTING -/* When BROTLI_REPORTING is defined extra reporting module have to be linked. */ -void BrotliDecoderOnFinish(const BrotliDecoderState* s); -#define BROTLI_DECODER_ON_FINISH(s) BrotliDecoderOnFinish(s); -#else -#if !defined(BROTLI_DECODER_ON_FINISH) -#define BROTLI_DECODER_ON_FINISH(s) (void)(s); -#endif -#endif - void BrotliDecoderStateCleanup(BrotliDecoderState* s) { BrotliDecoderStateCleanupAfterMetablock(s); -- cgit v1.1