X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fdrivers.c;h=c6165b6360c71778b63b5ffcf7b656a6b06a72a2;hb=58ffcf97121453fb53e885338e23e54c7ed78659;hp=a5c21a08097de35395e4d9d98b322867b93c9779;hpb=ced48274051be6b3b1ed612260c893fdb2525946;p=libsigrok.git diff --git a/src/drivers.c b/src/drivers.c index a5c21a08..c6165b63 100644 --- a/src/drivers.c +++ b/src/drivers.c @@ -18,6 +18,7 @@ * along with this program. If not, see . */ +#include #include #include #include "libsigrok-internal.h" @@ -26,7 +27,7 @@ * sr_driver_list is a special section contains pointers to all the hardware * drivers built into the library. The __start and __stop symbols are * auto-generated by the linker (OSX needs a little help) and point to the start - * and end of the section. They are used to iterate over the list of all + * and end of the section. They are used to iterate over the list of all * drivers. */ #ifdef __APPLE__ @@ -44,13 +45,14 @@ extern struct sr_dev_driver *__stop_sr_driver_list; */ SR_API void sr_drivers_init(struct sr_context *ctx) { - struct sr_dev_driver **drivers; GArray *array; array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *)); - for (drivers = &__start_sr_driver_list; drivers < &__stop_sr_driver_list; - drivers++) +#ifdef HAVE_DRIVERS + for (struct sr_dev_driver **drivers = &__start_sr_driver_list; + drivers < &__stop_sr_driver_list; drivers++) g_array_append_val(array, *drivers); +#endif ctx->driver_list = (struct sr_dev_driver **)array->data; g_array_free(array, FALSE); }