aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2010-06-02 23:09:22 +0300
committerLasse Collin <lasse.collin@tukaani.org>2010-06-02 23:09:22 +0300
commitb5fbab6123a39c9a55cd5d7af410e9aae067d5f8 (patch)
tree0e864fbc2f2ac3719bb063cfb4775c07a459bff4 /src
parentFix a Windows-specific FIXME in signal handling code. (diff)
downloadxz-b5fbab6123a39c9a55cd5d7af410e9aae067d5f8.tar.xz
Silence a bogus Valgrind warning.
When using -O2 with GCC, it liked to swap two comparisons in one "if" statement. It's otherwise fine except that the latter part, which is seemingly never executed, got executed (nothing wrong with that) and then triggered warning in Valgrind about conditional jump depending on uninitialized variable. A few people find this annoying so do things a bit differently to avoid the warning.
Diffstat (limited to 'src')
-rw-r--r--src/liblzma/lz/lz_encoder.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/liblzma/lz/lz_encoder.c b/src/liblzma/lz/lz_encoder.c
index 691fe72d..9e980a2c 100644
--- a/src/liblzma/lz/lz_encoder.c
+++ b/src/liblzma/lz/lz_encoder.c
@@ -341,7 +341,7 @@ lz_encoder_prepare(lzma_mf *mf, lzma_allocator *allocator,
// Deallocate the old hash array if it exists and has different size
// than what is needed now.
- if (mf->hash != NULL && old_count != new_count) {
+ if (old_count != new_count) {
lzma_free(mf->hash, allocator);
mf->hash = NULL;
}
@@ -444,6 +444,8 @@ lzma_lz_encoder_memusage(const lzma_lz_options *lz_options)
lzma_mf mf = {
.buffer = NULL,
.hash = NULL,
+ .hash_size_sum = 0,
+ .sons_count = 0,
};
// Setup the size information into mf.
@@ -519,6 +521,8 @@ lzma_lz_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
next->coder->mf.buffer = NULL;
next->coder->mf.hash = NULL;
+ next->coder->mf.hash_size_sum = 0;
+ next->coder->mf.sons_count = 0;
next->coder->next = LZMA_NEXT_CODER_INIT;
}