lz_decompress: Read "ctrl" inside loop

Remove code duplication

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
This commit is contained in:
Frediano Ziglio 2019-05-10 17:08:41 +01:00
parent a446b5b27b
commit d5d1d5b0bf

View File

@ -223,9 +223,9 @@ static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size)
{
OUT_PIXEL *op = out_buf;
OUT_PIXEL *const op_limit = out_buf + size;
uint32_t ctrl = decode(encoder);
for (;;) {
uint32_t ctrl = decode(encoder);
if (ctrl >= MAX_COPY) { // reference (dictionary/RLE)
/* retrieving the reference and the match length */
@ -305,7 +305,6 @@ static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size)
if (LZ_UNEXPECT_CONDITIONAL(op >= op_limit)) {
break;
}
ctrl = decode(encoder);
}
return (op - out_buf);