]> sigrok.org Git - libsigrok.git/commitdiff
output/srzip: reduce text line length, remove "dead code"
authorGerhard Sittig <redacted>
Fri, 29 Dec 2023 11:39:05 +0000 (12:39 +0100)
committerGerhard Sittig <redacted>
Fri, 29 Dec 2023 20:23:47 +0000 (21:23 +0100)
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.

src/output/srzip.c

index c1e2e438dac078e32c9d7c3e7155bffcdabed03c..3be0bccb29f3cd316095ad48d3895d570e4f6381 100644 (file)
@@ -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;
                }
        }