From 25190700e2f72179bf2a77c28be82c5081fde0bb Mon Sep 17 00:00:00 2001 From: Evgenii Kliuchnikov Date: Thu, 28 Aug 2025 10:16:48 -0700 Subject: [PATCH] use BROTLI_COLD in enc PiperOrigin-RevId: 800516878 --- c/enc/dictionary_hash.c | 2 +- c/enc/encode.c | 11 ++++++----- c/enc/static_dict_lut.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/c/enc/dictionary_hash.c b/c/enc/dictionary_hash.c index db13331..f367046 100644 --- a/c/enc/dictionary_hash.c +++ b/c/enc/dictionary_hash.c @@ -21,7 +21,7 @@ extern "C" { #endif #if (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_NONE) -BROTLI_BOOL BrotliEncoderInitDictionaryHash( +BROTLI_BOOL BROTLI_COLD BrotliEncoderInitDictionaryHash( const BrotliDictionary* dict, uint16_t* words, uint8_t* lengths) { size_t global_idx = 0; size_t len; diff --git a/c/enc/encode.c b/c/enc/encode.c index 279f173..ba21aa2 100644 --- a/c/enc/encode.c +++ b/c/enc/encode.c @@ -1774,7 +1774,7 @@ BrotliEncoderPreparedDictionary* BrotliEncoderPrepareDictionary( return (BrotliEncoderPreparedDictionary*)managed_dictionary; } -void BrotliEncoderDestroyPreparedDictionary( +void BROTLI_COLD BrotliEncoderDestroyPreparedDictionary( BrotliEncoderPreparedDictionary* dictionary) { ManagedDictionary* dict = (ManagedDictionary*)dictionary; if (!dictionary) return; @@ -1800,7 +1800,8 @@ void BrotliEncoderDestroyPreparedDictionary( BrotliDestroyManagedDictionary(dict); } -BROTLI_BOOL BrotliEncoderAttachPreparedDictionary(BrotliEncoderState* state, +BROTLI_BOOL BROTLI_COLD BrotliEncoderAttachPreparedDictionary( + BrotliEncoderState* state, const BrotliEncoderPreparedDictionary* dictionary) { /* First field of dictionary structs */ const BrotliEncoderPreparedDictionary* dict = dictionary; @@ -1857,8 +1858,8 @@ BROTLI_BOOL BrotliEncoderAttachPreparedDictionary(BrotliEncoderState* state, return BROTLI_TRUE; } -size_t BrotliEncoderEstimatePeakMemoryUsage(int quality, int lgwin, - size_t input_size) { +size_t BROTLI_COLD BrotliEncoderEstimatePeakMemoryUsage(int quality, int lgwin, + size_t input_size) { BrotliEncoderParams params; size_t memory_manager_slots = BROTLI_ENCODER_MEMORY_MANAGER_SLOTS; size_t memory_manager_size = memory_manager_slots * sizeof(void*); @@ -1925,7 +1926,7 @@ size_t BrotliEncoderEstimatePeakMemoryUsage(int quality, int lgwin, histogram_size); } } -size_t BrotliEncoderGetPreparedDictionarySize( +size_t BROTLI_COLD BrotliEncoderGetPreparedDictionarySize( const BrotliEncoderPreparedDictionary* prepared_dictionary) { /* First field of dictionary structs */ const BrotliEncoderPreparedDictionary* prepared = prepared_dictionary; diff --git a/c/enc/static_dict_lut.c b/c/enc/static_dict_lut.c index 4cdd8a1..b7a8706 100644 --- a/c/enc/static_dict_lut.c +++ b/c/enc/static_dict_lut.c @@ -24,7 +24,7 @@ extern "C" { #if (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_NONE) /* TODO(eustas): deal with largest bucket(s). Not it contains 163 items. */ -static BROTLI_BOOL DoBrotliEncoderInitStaticDictionaryLut( +static BROTLI_BOOL BROTLI_COLD DoBrotliEncoderInitStaticDictionaryLut( const BrotliDictionary* dict, uint16_t* buckets, DictWord* words, void* arena) { DictWord* slots = (DictWord*)arena;