]> sigrok.org Git - libsigrok.git/blobdiff - src/backend.c
sr_scpi_free(): Allow NULL as argument.
[libsigrok.git] / src / backend.c
index e829912e914d071dcebf3aa148b01f0bc6c52f1b..379478a0704dd73b4ed366e767f57ba06146d21e 100644 (file)
@@ -468,8 +468,6 @@ SR_API int sr_init(struct sr_context **ctx)
 {
        int ret = SR_ERR;
        struct sr_context *context;
-       struct sr_dev_driver ***lists, **drivers;
-       GArray *array;
 #ifdef _WIN32
        WSADATA wsadata;
 #endif
@@ -483,13 +481,7 @@ SR_API int sr_init(struct sr_context **ctx)
 
        context = g_malloc0(sizeof(struct sr_context));
 
-       /* Generate ctx->driver_list at runtime. */
-       array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
-       for (lists = drivers_lists; *lists; lists++)
-               for (drivers = *lists; *drivers; drivers++)
-                       g_array_append_val(array, *drivers);
-       context->driver_list = (struct sr_dev_driver **)array->data;
-       g_array_free(array, FALSE);
+       sr_drivers_init(context);
 
        if (sanity_check_all_drivers(context) < 0) {
                sr_err("Internal driver error(s), aborting.");