From f8e53c6e0a3026b8149c38d679d12f4c038c83ba Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 31 Jul 2010 17:57:39 +0000 Subject: [PATCH] Convert a few sizeof() users to ARRAY_SIZE git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1818 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 4 ++++ urjtag/src/bus/buses.c | 2 +- urjtag/src/flash/jedec.c | 6 ++---- urjtag/src/tap/cable.c | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index fe217bc1..0b7ab970 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,7 @@ +2010-07-31 Mike Frysinger + + * src/bus/buses.c, src/flash/jedec.c, src/tap/cable.c: Convert to ARRAY_SIZE. + 2010-07-30 Mike Frysinger * data/analog/bf592/STEPPINGS: Add support for bf592-0.1. diff --git a/urjtag/src/bus/buses.c b/urjtag/src/bus/buses.c index 0e42fb47..e59960ff 100644 --- a/urjtag/src/bus/buses.c +++ b/urjtag/src/bus/buses.c @@ -212,5 +212,5 @@ static const urj_param_descr_t bus_param[] = const urj_param_list_t urj_bus_param_list = { .list = bus_param, - .n = sizeof bus_param / sizeof bus_param[0], + .n = ARRAY_SIZE (bus_param) }; diff --git a/urjtag/src/flash/jedec.c b/urjtag/src/flash/jedec.c index 0d33cbec..e50a7feb 100644 --- a/urjtag/src/flash/jedec.c +++ b/urjtag/src/flash/jedec.c @@ -495,8 +495,7 @@ urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr, devid = URJ_BUS_READ (bus, adr + (1 << 1)); URJ_BUS_WRITE (bus, adr, 0xf0); - for (dev_idx = sizeof (table) / sizeof (struct amd_flash_info) - 1; - dev_idx >= 0; dev_idx--) + for (dev_idx = ARRAY_SIZE (table) - 1; dev_idx >= 0; dev_idx--) { if (table[dev_idx].interface_width == CFI_INTERFACE_X16 || table[dev_idx].interface_width == CFI_INTERFACE_X8_X16) @@ -526,8 +525,7 @@ urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr, devid = URJ_BUS_READ (bus, adr + 1); URJ_BUS_WRITE (bus, adr, 0xf0); - for (dev_idx = sizeof (table) / sizeof (struct amd_flash_info) - 1; - dev_idx >= 0; dev_idx--) + for (dev_idx = ARRAY_SIZE (table) - 1; dev_idx >= 0; dev_idx--) { if (table[dev_idx].interface_width == CFI_INTERFACE_X8) { diff --git a/urjtag/src/tap/cable.c b/urjtag/src/tap/cable.c index c58c3c7a..99986d49 100644 --- a/urjtag/src/tap/cable.c +++ b/urjtag/src/tap/cable.c @@ -677,5 +677,5 @@ static const urj_param_descr_t cable_param[] = const urj_param_list_t urj_cable_param_list = { .list = cable_param, - .n = sizeof cable_param / sizeof cable_param[0], + .n = ARRAY_SIZE (cable_param), };