]> sigrok.org Git - libsigrok.git/blobdiff - src/scpi/scpi.c
scpi: Minor style nits
[libsigrok.git] / src / scpi / scpi.c
index e54427ff0b3445c107a0e46ee24cb1cb2fb4ac97..222201ce279b5ca8fb3950cb6c7060d66154134a 100644 (file)
@@ -90,7 +90,7 @@ static const struct sr_scpi_dev_inst *scpi_devs[] = {
        &scpi_libgpib_dev,
 #endif
 #ifdef HAVE_LIBSERIALPORT
-       &scpi_serial_dev,  /* must be last as it matches any resource */
+       &scpi_serial_dev, /* Must be last as it matches any resource. */
 #endif
 };
 
@@ -419,12 +419,13 @@ SR_PRIV int sr_scpi_get_data(struct sr_scpi_dev_inst *scpi,
        GString *response;
        gint64 laststart;
        unsigned int elapsed_ms;
-       unsigned int offset = 0;
+       unsigned int offset;
        int space;
 
-       if (command)
+       if (command) {
                if (sr_scpi_send(scpi, command) != SR_OK)
                        return SR_ERR;
+       }
 
        if (sr_scpi_read_begin(scpi) != SR_OK)
                return SR_ERR;
@@ -446,7 +447,7 @@ SR_PRIV int sr_scpi_get_data(struct sr_scpi_dev_inst *scpi,
                        sr_err("Incompletely read SCPI response.");
                        return SR_ERR;
                } else if (len > 0) {
-                       laststart = g_get_monotonic_time();
+                       laststart = g_get_monotonic_time();
                }
                offset += len;
                g_string_set_size(response, offset);
@@ -723,6 +724,7 @@ SR_PRIV int sr_scpi_get_uint8v(struct sr_scpi_dev_inst *scpi,
 
        return ret;
 }
+
 /**
  * Send a SCPI command, read the reply, parse it as binary data with a
  * "definite length block" header and store the as an result in scpi_response.
@@ -796,7 +798,6 @@ SR_PRIV int sr_scpi_get_block(struct sr_scpi_dev_inst *scpi,
        return ret;
 }
 
-
 /**
  * Send the *IDN? SCPI command, receive the reply, parse it and store the
  * reply as a sr_scpi_hw_info structure in the supplied scpi_response pointer.