From: Uwe Hermann Date: Wed, 21 Feb 2018 20:36:58 +0000 (+0100) Subject: siglent_sds_channel_start(): Use ternary operator to shorten code. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=eb354840f0c663ec89114ab0637e7d0b3f2258b9;p=libsigrok.git siglent_sds_channel_start(): Use ternary operator to shorten code. --- diff --git a/src/hardware/siglent-sds/protocol.c b/src/hardware/siglent-sds/protocol.c index 251eb5d0..e33c4adb 100644 --- a/src/hardware/siglent-sds/protocol.c +++ b/src/hardware/siglent-sds/protocol.c @@ -216,6 +216,7 @@ SR_PRIV int siglent_sds_channel_start(const struct sr_dev_inst *sdi) { struct dev_context *devc; struct sr_channel *ch; + const char *s; if (!(devc = sdi->priv)) return SR_ERR; @@ -227,15 +228,9 @@ SR_PRIV int siglent_sds_channel_start(const struct sr_dev_inst *sdi) switch (devc->model->series->protocol) { case NON_SPO_MODEL: case SPO_MODEL: - if (ch->type == SR_CHANNEL_LOGIC) { - if (sr_scpi_send(sdi->conn, "D%d:WF?", - ch->index + 1) != SR_OK) - return SR_ERR; - } else { - if (sr_scpi_send(sdi->conn, "C%d:WF? ALL", - ch->index + 1) != SR_OK) - return SR_ERR; - } + s = (ch->type == SR_CHANNEL_LOGIC) ? "D%d:WF?" : "C%d:WF? ALL"; + if (sr_scpi_send(sdi->conn, s, ch->index + 1) != SR_OK) + return SR_ERR; siglent_sds_set_wait_event(devc, WAIT_NONE); break; }