]> sigrok.org Git - libsigrok.git/commitdiff
scpi: nit, use glib to determine string vector length
authorGerhard Sittig <redacted>
Wed, 7 Nov 2018 19:27:17 +0000 (20:27 +0100)
committerGerhard Sittig <redacted>
Sat, 10 Nov 2018 19:11:35 +0000 (20:11 +0100)
Replace a DIY length calculation with a glib call.

src/scpi/scpi.c

index a01e13e037da3575b37c42e935dc5cb91e932cdd..603b15b13cd3e46687bc044160fd232cb0338df0 100644 (file)
@@ -1091,9 +1091,7 @@ SR_PRIV int sr_scpi_get_hw_id(struct sr_scpi_dev_inst *scpi,
         * model, serial number of the instrument and the firmware version.
         */
        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);