From: Gerhard Sittig Date: Wed, 7 Nov 2018 19:27:17 +0000 (+0100) Subject: scpi: nit, use glib to determine string vector length X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=a1ce15d4a1a2eb3d69f64aefda8c7a1931bfe642;p=libsigrok.git scpi: nit, use glib to determine string vector length Replace a DIY length calculation with a glib call. --- diff --git a/src/scpi/scpi.c b/src/scpi/scpi.c index a01e13e0..603b15b1 100644 --- a/src/scpi/scpi.c +++ b/src/scpi/scpi.c @@ -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);