Add ARRAY_SIZE helper.

This commit is contained in:
Uwe Hermann 2010-04-13 00:34:20 +02:00
parent 02076d69f9
commit fdd20b5239
2 changed files with 5 additions and 1 deletions

View File

@ -156,7 +156,7 @@ struct sigrok_device_instance *zp_open_device(int device_index)
if(des.idVendor == USB_VENDOR) {
if(libusb_get_bus_number(devlist[i]) == sdi->usb->bus &&
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) {
g_message("Found PID=%04X (%s)", des.idProduct, zeroplus_models[j].model_name);
num_channels = zeroplus_models[j].channels;

View File

@ -54,6 +54,10 @@
#define MHZ(n) (n * 1000000)
#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() */
enum {
T_UINT64,