drivers: don't try to access the sr_driver_list section with no driver compiled.
This closes bug #820.
This commit is contained in:
parent
5eb4ba29d0
commit
bf85ea2110
|
@ -211,7 +211,7 @@ m4_define([_SR_DRIVER], [
|
||||||
sr_driver_summary_append "$2" "$sr_hw_info"
|
sr_driver_summary_append "$2" "$sr_hw_info"
|
||||||
|
|
||||||
AM_CONDITIONAL([$3], [test "x[$]$3" = xyes])
|
AM_CONDITIONAL([$3], [test "x[$]$3" = xyes])
|
||||||
AM_COND_IF([$3], [AC_DEFINE([HAVE_$3], [1], [Whether to support $1 device.])])
|
AM_COND_IF([$3], [AC_DEFINE([HAVE_$3], [1], [Whether to support $1 device.]) AC_DEFINE([HAVE_DRIVERS], [1], [Whether at least one driver is enabled.])])
|
||||||
])
|
])
|
||||||
|
|
||||||
## SR_DRIVER(Device name, driver-name, [dependencies...])
|
## SR_DRIVER(Device name, driver-name, [dependencies...])
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <libsigrok/libsigrok.h>
|
#include <libsigrok/libsigrok.h>
|
||||||
#include "libsigrok-internal.h"
|
#include "libsigrok-internal.h"
|
||||||
|
@ -44,13 +45,14 @@ extern struct sr_dev_driver *__stop_sr_driver_list;
|
||||||
*/
|
*/
|
||||||
SR_API void sr_drivers_init(struct sr_context *ctx)
|
SR_API void sr_drivers_init(struct sr_context *ctx)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver **drivers;
|
|
||||||
GArray *array;
|
GArray *array;
|
||||||
|
|
||||||
array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
|
array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
|
||||||
for (drivers = &__start_sr_driver_list; drivers < &__stop_sr_driver_list;
|
#ifdef HAVE_DRIVERS
|
||||||
drivers++)
|
for (struct sr_dev_driver **drivers = &__start_sr_driver_list;
|
||||||
|
drivers < &__stop_sr_driver_list; drivers++)
|
||||||
g_array_append_val(array, *drivers);
|
g_array_append_val(array, *drivers);
|
||||||
|
#endif
|
||||||
ctx->driver_list = (struct sr_dev_driver **)array->data;
|
ctx->driver_list = (struct sr_dev_driver **)array->data;
|
||||||
g_array_free(array, FALSE);
|
g_array_free(array, FALSE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue