From: Gerhard Sittig Date: Fri, 29 Dec 2023 11:39:05 +0000 (+0100) Subject: output/srzip: reduce text line length, remove "dead code" X-Git-Url: http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=da175133ede9385cb4555f1e326333100abb35a2 output/srzip: reduce text line length, remove "dead code" Move an instruction to reduce its text line length. Also happens to put the calculation of remaining buffer space and the current write position in closer proximity, improving maintainability in the process. Remove an assignment after appending to the archive and before iterating the input samples loop again. Eliminates code that never took effect. The value gets determined at the loop body's start anyway. --- diff --git a/src/output/srzip.c b/src/output/srzip.c index c1e2e438..3be0bccb 100644 --- a/src/output/srzip.c +++ b/src/output/srzip.c @@ -461,8 +461,8 @@ static int zip_append_queue(const struct sr_output *o, send_count = feed_unitsize ? length / feed_unitsize : 0; while (send_count) { remain = buff->alloc_size - buff->fill_size; + wrptr = &buff->samples[buff->fill_size * buff->zip_unit_size]; if (remain) { - wrptr = &buff->samples[buff->fill_size * buff->zip_unit_size]; copy_count = MIN(send_count, remain); if (sample_skip_size || sample_pad_size) copy_count = 1; @@ -484,7 +484,6 @@ static int zip_append_queue(const struct sr_output *o, if (ret != SR_OK) return ret; buff->fill_size = 0; - remain = buff->alloc_size - buff->fill_size; } }