Add ARRAY_SIZE helper.
This commit is contained in:
parent
02076d69f9
commit
fdd20b5239
|
@ -156,7 +156,7 @@ struct sigrok_device_instance *zp_open_device(int device_index)
|
||||||
if(des.idVendor == USB_VENDOR) {
|
if(des.idVendor == USB_VENDOR) {
|
||||||
if(libusb_get_bus_number(devlist[i]) == sdi->usb->bus &&
|
if(libusb_get_bus_number(devlist[i]) == sdi->usb->bus &&
|
||||||
libusb_get_device_address(devlist[i]) == sdi->usb->address) {
|
libusb_get_device_address(devlist[i]) == sdi->usb->address) {
|
||||||
for (j = 0; j < sizeof(zeroplus_models) / sizeof(zeroplus_models[0]); j++) {
|
for (j = 0; j < ARRAY_SIZE(zeroplus_models); j++) {
|
||||||
if (des.idProduct == zeroplus_models[j].pid) {
|
if (des.idProduct == zeroplus_models[j].pid) {
|
||||||
g_message("Found PID=%04X (%s)", des.idProduct, zeroplus_models[j].model_name);
|
g_message("Found PID=%04X (%s)", des.idProduct, zeroplus_models[j].model_name);
|
||||||
num_channels = zeroplus_models[j].channels;
|
num_channels = zeroplus_models[j].channels;
|
||||||
|
|
4
sigrok.h
4
sigrok.h
|
@ -54,6 +54,10 @@
|
||||||
#define MHZ(n) (n * 1000000)
|
#define MHZ(n) (n * 1000000)
|
||||||
#define GHZ(n) (n * 1000000000)
|
#define GHZ(n) (n * 1000000000)
|
||||||
|
|
||||||
|
#ifndef ARRAY_SIZE
|
||||||
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Data types, used by hardware plugins for set_configuration() */
|
/* Data types, used by hardware plugins for set_configuration() */
|
||||||
enum {
|
enum {
|
||||||
T_UINT64,
|
T_UINT64,
|
||||||
|
|
Loading…
Reference in New Issue