scpi: nit, use glib to determine string vector length

Replace a DIY length calculation with a glib call.
This commit is contained in:
Gerhard Sittig 2018-11-07 20:27:17 +01:00
parent a019bc48fd
commit a1ce15d4a1
1 changed files with 1 additions and 3 deletions

View 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. * model, serial number of the instrument and the firmware version.
*/ */
tokens = g_strsplit(response, ",", 0); tokens = g_strsplit(response, ",", 0);
num_tokens = g_strv_length(tokens);
for (num_tokens = 0; tokens[num_tokens] != NULL; num_tokens++);
if (num_tokens < 4) { if (num_tokens < 4) {
sr_dbg("IDN response not according to spec: %80.s.", response); sr_dbg("IDN response not according to spec: %80.s.", response);
g_strfreev(tokens); g_strfreev(tokens);