]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/openbench-logic-sniffer/protocol.c
ols: Don't store temporary data in device context
[libsigrok.git] / src / hardware / openbench-logic-sniffer / protocol.c
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]);