struct config_device *cfdev;
int i;
- if (!(cfdev = malloc(sizeof(struct config_device)))) {
+ if (!(cfdev = malloc(sizeof(*cfdev)))) {
ERROR("sigrok plugin: malloc() failed.");
return -1;
}
return 0;
}
-static char *sigrok_value_type(const struct sr_datafeed_analog *analog)
+static const char *sigrok_value_type(const struct sr_datafeed_analog *analog)
{
- char *s;
+ const char *s;
if (analog->mq == SR_MQ_VOLTAGE)
s = "voltage";
drvopts = NULL;
if (cfdev->conn) {
- if (!(src = malloc(sizeof(struct sr_config))))
+ if (!(src = malloc(sizeof(*src))))
return -1;
src->key = SR_CONF_CONN;
src->data = g_variant_new_string(cfdev->conn);
drvopts = g_slist_append(drvopts, src);
}
if (cfdev->serialcomm) {
- if (!(src = malloc(sizeof(struct sr_config))))
+ if (!(src = malloc(sizeof(*src))))
return -1;
src->key = SR_CONF_SERIALCOMM;
src->data = g_variant_new_string(cfdev->serialcomm);
return -1;
}
- if ((status = plugin_thread_create(&sr_thread, NULL, sigrok_read_thread,
- NULL)) != 0) {
+ status = plugin_thread_create(&sr_thread, NULL, sigrok_read_thread,
+ NULL);
+ if (status != 0)
+ {
+ char errbuf[1024];
ERROR("sigrok plugin: Failed to create thread: %s.",
- strerror(status));
+ sstrerror (errno, errbuf, sizeof (errbuf)));
return -1;
}
sr_thread_running = TRUE;