]> sigrok.org Git - libsigrok.git/commitdiff
siglent-sds: prefer common glib routine to get vector's length
authorGerhard Sittig <redacted>
Sun, 16 May 2021 12:57:54 +0000 (14:57 +0200)
committerGerhard Sittig <redacted>
Sat, 22 May 2021 06:06:58 +0000 (08:06 +0200)
Replace an open coded loop with a call to common glib code.

src/hardware/siglent-sds/protocol.c

index fde58d003e524e1f52b7ab596cf6e5b2b4649b51..919df9b27c30830ff16ff3f41c73b918abebc1a5 100644 (file)
@@ -782,7 +782,7 @@ SR_PRIV int siglent_sds_get_dev_cfg(const struct sr_dev_inst *sdi)
        if (sr_scpi_get_string(sdi->conn, "TRSE?", &response) != SR_OK)
                return SR_ERR;
        tokens = g_strsplit(response, ",", 0);
-       for (num_tokens = 0; tokens[num_tokens] != NULL; num_tokens++);
+       num_tokens = g_strv_length(tokens);
        if (num_tokens < 4) {
                sr_dbg("IDN response not according to spec: %80.s.", response);
                g_strfreev(tokens);