Commit 47754726 for xz
commit 47754726e9303bdd466d084a99dbb7d18297985b
Author: Lasse Collin <lasse.collin@tukaani.org>
Date: Sat Nov 28 12:20:28 2026 +0200
liblzma: mt enc: Refactor when coder->next is assigned
It was done this way in mt decoder in the previous commit. simple_coder.c
has always done it like this.
diff --git a/src/liblzma/common/stream_encoder_mt.c b/src/liblzma/common/stream_encoder_mt.c
index fd0eb98d..f520afa7 100644
--- a/src/liblzma/common/stream_encoder_mt.c
+++ b/src/liblzma/common/stream_encoder_mt.c
@@ -1066,25 +1066,22 @@ stream_encoder_mt_init(lzma_next_coder *next, const lzma_allocator *allocator,
if (coder == NULL)
return LZMA_MEM_ERROR;
- next->coder = coder;
-
// For the mutex and condition variable initializations
// the error handling has to be done here because
// stream_encoder_mt_end() doesn't know if they have
// already been initialized or not.
if (mythread_mutex_init(&coder->mutex)) {
lzma_free(coder, allocator);
- next->coder = NULL;
return LZMA_MEM_ERROR;
}
if (mythread_cond_init(&coder->cond)) {
mythread_mutex_destroy(&coder->mutex);
lzma_free(coder, allocator);
- next->coder = NULL;
return LZMA_MEM_ERROR;
}
+ next->coder = coder;
next->code = &stream_encode_mt;
next->end = &stream_encoder_mt_end;
next->get_progress = &get_progress;