From: Uwe Hermann Date: Tue, 6 Aug 2013 11:38:50 +0000 (+0200) Subject: new-driver: Shorten dev_list(). X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=28fca3a8f9e73c86d27f20065e51c69a9118a60e;p=sigrok-util.git new-driver: Shorten dev_list(). --- diff --git a/source/drv-api.c b/source/drv-api.c index 0ef289d..ae594f1 100644 --- a/source/drv-api.c +++ b/source/drv-api.c @@ -22,7 +22,6 @@ SR_PRIV struct sr_dev_driver ${lib}_driver_info; static struct sr_dev_driver *di = &${lib}_driver_info; - static int init(struct sr_context *sr_ctx) { return std_init(sr_ctx, di, LOG_PREFIX); @@ -47,11 +46,7 @@ static GSList *scan(GSList *options) static GSList *dev_list(void) { - struct drv_context *drvc; - - drvc = di->priv; - - return drvc->instances; + return ((struct drv_context *)(di->priv))->instances; } static int dev_clear(void) diff --git a/source/drv-protocol.c b/source/drv-protocol.c index 75ab353..47ade0d 100644 --- a/source/drv-protocol.c +++ b/source/drv-protocol.c @@ -21,11 +21,11 @@ SR_PRIV int ${lib}_receive_data(int fd, int revents, void *cb_data) { - (void)fd; - const struct sr_dev_inst *sdi; struct dev_context *devc; + (void)fd; + if (!(sdi = cb_data)) return TRUE;