X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ffluke-dmm%2Ffluke.c;h=e708518d90f1dd3f003462bced985c955131703e;hb=6c7d80afcaf043eb8128a3102519032850fec1af;hp=f86b7d7b17108a7241388188f35ee3b0e4699f54;hpb=204014007f30a3980e6abb35b91bf654d190d81f;p=libsigrok.git diff --git a/src/hardware/fluke-dmm/fluke.c b/src/hardware/fluke-dmm/fluke.c index f86b7d7b..e708518d 100644 --- a/src/hardware/fluke-dmm/fluke.c +++ b/src/hardware/fluke-dmm/fluke.c @@ -40,14 +40,14 @@ static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi, if ((e = strstr(tokens[1], "Out of range"))) { is_oor = TRUE; fvalue = -1; - while(*e && *e != '.') + while (*e && *e != '.') e++; } else { is_oor = FALSE; /* Delimit the float, since sr_atof_ascii() wants only * a valid float here. */ e = tokens[1]; - while(*e && *e != ' ') + while (*e && *e != ' ') e++; *e++ = '\0'; if (sr_atof_ascii(tokens[1], &fvalue) != SR_OK || fvalue == 0.0) { @@ -56,13 +56,11 @@ static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi, return NULL; } } - while(*e && *e == ' ') + while (*e && *e == ' ') e++; - if (!(analog = g_try_malloc0(sizeof(struct sr_datafeed_analog)))) - return NULL; - if (!(analog->data = g_try_malloc(sizeof(float)))) - return NULL; + analog = g_malloc0(sizeof(struct sr_datafeed_analog)); + analog->data = g_malloc(sizeof(float)); analog->channels = sdi->channels; analog->num_samples = 1; if (is_oor) @@ -170,10 +168,8 @@ static struct sr_datafeed_analog *handle_qm_28x(const struct sr_dev_inst *sdi, return NULL; } - if (!(analog = g_try_malloc0(sizeof(struct sr_datafeed_analog)))) - return NULL; - if (!(analog->data = g_try_malloc(sizeof(float)))) - return NULL; + analog = g_malloc0(sizeof(struct sr_datafeed_analog)); + analog->data = g_malloc(sizeof(float)); analog->channels = sdi->channels; analog->num_samples = 1; *analog->data = fvalue; @@ -386,7 +382,6 @@ static void handle_qm_19x_data(const struct sr_dev_inst *sdi, char **tokens) /* Don't have valid metadata yet. */ return; - if (devc->mq == SR_MQ_RESISTANCE && isnan(fvalue)) fvalue = INFINITY; else if (devc->mq == SR_MQ_CONTINUITY) { @@ -499,7 +494,7 @@ SR_PRIV int fluke_receive_data(int fd, int revents, void *cb_data) serial = sdi->conn; if (revents == G_IO_IN) { /* Serial data arrived. */ - while(FLUKEDMM_BUFSIZE - devc->buflen - 1 > 0) { + while (FLUKEDMM_BUFSIZE - devc->buflen - 1 > 0) { len = serial_read_nonblocking(serial, devc->buf + devc->buflen, 1); if (len < 1) break;