]> sigrok.org Git - libsigrok.git/commitdiff
ols: Don't store temporary data in device context
authorv1ne <redacted>
Tue, 23 Feb 2021 21:36:33 +0000 (22:36 +0100)
committerSoeren Apel <redacted>
Fri, 10 Sep 2021 21:01:00 +0000 (23:01 +0200)
src/hardware/openbench-logic-sniffer/protocol.c
src/hardware/openbench-logic-sniffer/protocol.h

index dbf291439a1c71a28fd8ce48dce9dc83049fca29..bf065c760889ea21d2cfad6b93982eaec833c3d4 100644 (file)
@@ -476,7 +476,7 @@ SR_PRIV int ols_receive_data(int fd, int revents, void *cb_data)
                                 * the number of channels.
                                 */
                                j = 0;
-                               memset(devc->tmp_sample, 0, 4);
+                               uint8_t tmp_sample[4] = { 0, 0, 0, 0 };
                                for (i = 0; i < 4; i++) {
                                        if (((devc->capture_flags >> 2) &
                                             (1 << i)) == 0) {
@@ -485,17 +485,17 @@ SR_PRIV int ols_receive_data(int fd, int revents, void *cb_data)
                                                 * enabled, copy from received
                                                 * sample.
                                                 */
-                                               devc->tmp_sample[i] =
+                                               tmp_sample[i] =
                                                        devc->sample[j++];
                                        } else if (devc->capture_flags &
                                                           CAPTURE_FLAG_DEMUX &&
                                                   (i > 2)) {
                                                /* group 2 & 3 get added to 0 & 1 */
-                                               devc->tmp_sample[i - 2] =
+                                               tmp_sample[i - 2] =
                                                        devc->sample[j++];
                                        }
                                }
-                               memcpy(devc->sample, devc->tmp_sample, 4);
+                               memcpy(devc->sample, tmp_sample, 4);
                                sr_spew("Expanded sample: 0x%.2hhx%.2hhx%.2hhx%.2hhx ",
                                        devc->sample[3], devc->sample[2],
                                        devc->sample[1], devc->sample[0]);
index 612b069f6b9889c0665f23715a18c501f6dc4c6e..01a3821366a593e684e046ed804bd7700e9ebf8c 100644 (file)
@@ -123,7 +123,6 @@ struct dev_context {
 
        unsigned int rle_count;
        unsigned char sample[4];
-       unsigned char tmp_sample[4];
        unsigned char *raw_sample_buf;
 };