diff options
author | Brotli <no-reply@google.com> | 2024-04-08 04:29:59 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-04-08 04:30:44 -0700 |
commit | cdbe7fc739c312719dac65a745d8668c04b5801a (patch) | |
tree | 48d72d2a6857b95a3f0962d2fc28b0d376f06e9e /c | |
parent | b6f2d49febdbee667037737a1a514c89e13eb4d3 (diff) | |
download | brotli-cdbe7fc739c312719dac65a745d8668c04b5801a.zip brotli-cdbe7fc739c312719dac65a745d8668c04b5801a.tar.gz brotli-cdbe7fc739c312719dac65a745d8668c04b5801a.tar.bz2 |
Internal change
PiperOrigin-RevId: 622802698
Diffstat (limited to 'c')
-rw-r--r-- | c/dec/state.c | 26 | ||||
-rw-r--r-- | c/enc/encode.c | 26 |
2 files changed, 32 insertions, 20 deletions
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); diff --git a/c/enc/encode.c b/c/enc/encode.c index 491361b..96c517b 100644 --- a/c/enc/encode.c +++ b/c/enc/encode.c @@ -687,7 +687,23 @@ static void BrotliEncoderCleanupParams(MemoryManager* m, BrotliCleanupSharedEncoderDictionary(m, ¶ms->dictionary); } +#ifdef BROTLI_REPORTING +/* When BROTLI_REPORTING is defined extra reporting module have to be linked. */ +void BrotliEncoderOnStart(const BrotliEncoderState* s); +void BrotliEncoderOnFinish(const BrotliEncoderState* s); +#define BROTLI_ENCODER_ON_START(s) BrotliEncoderOnStart(s); +#define BROTLI_ENCODER_ON_FINISH(s) BrotliEncoderOnFinish(s); +#else +#if !defined(BROTLI_ENCODER_ON_START) +#define BROTLI_ENCODER_ON_START(s) (void)(s); +#endif +#if !defined(BROTLI_ENCODER_ON_FINISH) +#define BROTLI_ENCODER_ON_FINISH(s) (void)(s); +#endif +#endif + static void BrotliEncoderInitState(BrotliEncoderState* s) { + BROTLI_ENCODER_ON_START(s); BrotliEncoderInitParams(&s->params); s->input_pos_ = 0; s->num_commands_ = 0; @@ -743,16 +759,6 @@ BrotliEncoderState* BrotliEncoderCreateInstance( return state; } -#ifdef BROTLI_REPORTING -/* When BROTLI_REPORTING is defined extra reporting module have to be linked. */ -void BrotliEncoderOnFinish(const BrotliEncoderState* s); -#define BROTLI_ENCODER_ON_FINISH(s) BrotliEncoderOnFinish(s); -#else -#if !defined(BROTLI_ENCODER_ON_FINISH) -#define BROTLI_ENCODER_ON_FINISH(s) (void)(s); -#endif -#endif - static void BrotliEncoderCleanupState(BrotliEncoderState* s) { MemoryManager* m = &s->memory_manager_; |