xz: Rename filters_memusage_max() to get_chains_memusage()

(cherry picked from commit 78e984399a)
This commit is contained in:
Lasse Collin 2024-05-13 17:07:22 +03:00
parent d7e2bf7e2d
commit 6f0db31713
1 changed files with 6 additions and 8 deletions

View File

@ -234,8 +234,7 @@ memlimit_too_small(uint64_t memory_usage)
// Calculate the memory usage of each filter chain. // Calculate the memory usage of each filter chain.
// Return the maximum memory usage of all of the filter chains. // Return the maximum memory usage of all of the filter chains.
static uint64_t static uint64_t
filters_memusage_max(uint64_t *chains_memusages, get_chains_memusage(uint64_t *chains_memusages, const lzma_mt *mt, bool encode)
const lzma_mt *mt, bool encode)
{ {
uint64_t max_memusage = 0; uint64_t max_memusage = 0;
@ -497,7 +496,7 @@ coder_set_compression_settings(void)
mt_options.block_size = block_size; mt_options.block_size = block_size;
mt_options.check = check; mt_options.check = check;
memory_usage = filters_memusage_max(encoder_memusages, memory_usage = get_chains_memusage(encoder_memusages,
&mt_options, true); &mt_options, true);
if (memory_usage != UINT64_MAX) if (memory_usage != UINT64_MAX)
message(V_DEBUG, _("Using up to %" PRIu32 message(V_DEBUG, _("Using up to %" PRIu32
@ -506,7 +505,7 @@ coder_set_compression_settings(void)
} else } else
# endif # endif
{ {
memory_usage = filters_memusage_max(encoder_memusages, memory_usage = get_chains_memusage(encoder_memusages,
NULL, true); NULL, true);
} }
#endif #endif
@ -528,8 +527,7 @@ coder_set_compression_settings(void)
#if defined(HAVE_ENCODERS) && defined(HAVE_DECODERS) #if defined(HAVE_ENCODERS) && defined(HAVE_DECODERS)
if (opt_mode == MODE_COMPRESS && message_verbosity_get() >= V_DEBUG) { if (opt_mode == MODE_COMPRESS && message_verbosity_get() >= V_DEBUG) {
const uint64_t decmem = filters_memusage_max( const uint64_t decmem = get_chains_memusage(NULL, NULL, false);
NULL, NULL, false);
if (decmem != UINT64_MAX) if (decmem != UINT64_MAX)
message(V_DEBUG, _("Decompression will need " message(V_DEBUG, _("Decompression will need "
"%s MiB of memory."), uint64_to_str( "%s MiB of memory."), uint64_to_str(
@ -556,7 +554,7 @@ coder_set_compression_settings(void)
// Reduce the number of threads by one and check // Reduce the number of threads by one and check
// the memory usage. // the memory usage.
--mt_options.threads; --mt_options.threads;
memory_usage = filters_memusage_max(encoder_memusages, memory_usage = get_chains_memusage(encoder_memusages,
&mt_options, true); &mt_options, true);
if (memory_usage == UINT64_MAX) if (memory_usage == UINT64_MAX)
message_bug(); message_bug();
@ -619,7 +617,7 @@ coder_set_compression_settings(void)
// the multithreaded mode but the output // the multithreaded mode but the output
// is also different. // is also different.
hardware_threads_set(1); hardware_threads_set(1);
memory_usage = filters_memusage_max(encoder_memusages, memory_usage = get_chains_memusage(encoder_memusages,
NULL, true); NULL, true);
message(V_WARNING, _("Switching to single-threaded mode " message(V_WARNING, _("Switching to single-threaded mode "
"to not exceed the memory usage limit of %s MiB"), "to not exceed the memory usage limit of %s MiB"),