]> sigrok.org Git - sigrok-cli.git/commitdiff
Add struct sr_context * to sr_driver_init() calls
authorPeter Stuge <redacted>
Sun, 21 Oct 2012 18:43:32 +0000 (20:43 +0200)
committerPeter Stuge <redacted>
Mon, 3 Dec 2012 03:10:16 +0000 (04:10 +0100)
libsigrok.git commit 193691ae1590eb31025d943ffbb0ea5c1047e6ca changes
the API of sr_driver_init() to take a struct sr_context * parameter as
allocated by sr_init().

Move our struct sr_context *sr_ctx out of main() into file global scope
so that it can be used easily in all calls to sr_driver_init().

sigrok-cli.c

index 4af47d2da2a3fe0470fee124af052e62fbcff140..367353623a124cb30def0e9bd3a9e3b653a53b0c 100644 (file)
@@ -36,6 +36,8 @@
 
 #define DEFAULT_OUTPUT_FORMAT "bits:width=64"
 
+static struct sr_context *sr_ctx = NULL;
+
 static uint64_t limit_samples = 0;
 static uint64_t limit_frames = 0;
 static struct sr_output_format *output_format = NULL;
@@ -162,7 +164,7 @@ static GSList *device_scan(void)
                        return NULL;
                }
                g_free(drvname);
-               if (sr_driver_init(driver) != SR_OK) {
+               if (sr_driver_init(sr_ctx, driver) != SR_OK) {
                        g_critical("Failed to initialize driver.");
                        return NULL;
                }
@@ -178,7 +180,7 @@ static GSList *device_scan(void)
                drivers = sr_driver_list();
                for (i = 0; drivers[i]; i++) {
                        driver = drivers[i];
-                       if (sr_driver_init(driver) != SR_OK) {
+                       if (sr_driver_init(sr_ctx, driver) != SR_OK) {
                                g_critical("Failed to initialize driver.");
                                return NULL;
                        }
@@ -1476,7 +1478,6 @@ int main(int argc, char **argv)
        int ret = 1;
        GOptionContext *context;
        GError *error;
-       struct sr_context *sr_ctx = NULL;
 
        g_log_set_default_handler(logger, NULL);