From: Uwe Hermann Date: Wed, 22 Feb 2012 20:48:30 +0000 (+0100) Subject: sr: No need for dynamic hardware driver registration. X-Git-Tag: sigrok-cli-0.3.0~21 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=bc8e240025339710ddf4f9f0827275ae9a1fe9b7;p=sigrok-cli.git sr: No need for dynamic hardware driver registration. We don't need or allow run-time registration of hardware drivers/plugins, they're added at compile-time. --- diff --git a/parsers.c b/parsers.c index 80015f5..cd0a15f 100644 --- a/parsers.c +++ b/parsers.c @@ -127,9 +127,9 @@ GHashTable *parse_generic_arg(const char *arg) struct sr_dev *parse_devstring(const char *devstring) { struct sr_dev *dev, *d; - struct sr_dev_plugin *plugin; - GSList *devs, *plugins, *l, *p; - int num_devs, dev_num, dev_cnt; + struct sr_dev_plugin **plugins; + GSList *devs, *l; + int i, num_devs, dev_num, dev_cnt; char *tmp; if (!devstring) @@ -165,11 +165,10 @@ struct sr_dev *parse_devstring(const char *devstring) */ dev = NULL; plugins = sr_hw_list(); - for (p = plugins; p; p = p->next) { - plugin = p->data; - if (strcmp(plugin->name, devstring)) + for (i = 0; plugins[i]; i++) { + if (strcmp(plugins[i]->name, devstring)) continue; - num_devs = sr_hw_init(plugin); + num_devs = sr_hw_init(plugins[i]); if (num_devs == 1) { devs = sr_dev_list(); dev = devs->data; diff --git a/sigrok-cli.c b/sigrok-cli.c index b9ed262..1b34bf5 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -85,8 +85,8 @@ static GOptionEntry optargs[] = { static void show_version(void) { - GSList *plugins, *p, *l; - struct sr_dev_plugin *plugin; + GSList *l; + struct sr_dev_plugin **plugins; struct sr_input_format **inputs; struct sr_output_format **outputs; struct srd_decoder *dec; @@ -96,9 +96,8 @@ static void show_version(void) printf("Supported hardware drivers:\n"); plugins = sr_hw_list(); - for (p = plugins; p; p = p->next) { - plugin = p->data; - printf(" %-20s %s\n", plugin->name, plugin->longname); + for (i = 0; plugins[i]; i++) { + printf(" %-20s %s\n", plugins[i]->name, plugins[i]->longname); } printf("\n");