From: Gerhard Sittig Date: Thu, 16 Mar 2023 02:31:12 +0000 (+0100) Subject: rdtech-tc: avoid mixing several iterations in the same for loop X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9e0333f04c09b0dc92920ae02c279b9bf003fa68;p=libsigrok.git rdtech-tc: avoid mixing several iterations in the same for loop Separate the iteration of a channels list, and indexing their associated binary helpers descriptions. Use the for() statement for list iteration exclusively, avoid the comma operator. --- diff --git a/src/hardware/rdtech-tc/protocol.c b/src/hardware/rdtech-tc/protocol.c index 39d52ba5..e1cff006 100644 --- a/src/hardware/rdtech-tc/protocol.c +++ b/src/hardware/rdtech-tc/protocol.c @@ -193,9 +193,11 @@ static void handle_poll_data(const struct sr_dev_inst *sdi) return; } - for (ch = sdi->channels, i = 0; ch; ch = g_slist_next(ch), i++) { + i = 0; + for (ch = sdi->channels; ch; ch = g_slist_next(ch)) { bv_send_analog_channel(sdi, ch->data, &devc->channels[i], poll_pkt, TC_POLL_LEN); + i++; } sr_sw_limits_update_samples_read(&devc->limits, 1);