Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/amrctl Use __arraycount instead of identical local macro.
details: https://anonhg.NetBSD.org/src/rev/dc4c31dcc6bd
branches: trunk
changeset: 779315:dc4c31dcc6bd
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Fri May 18 13:47:33 2012 +0000
description:
Use __arraycount instead of identical local macro.
diffstat:
sbin/amrctl/amrctl.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diffs (56 lines):
diff -r 8dc362cff1d8 -r dc4c31dcc6bd sbin/amrctl/amrctl.c
--- a/sbin/amrctl/amrctl.c Fri May 18 13:41:37 2012 +0000
+++ b/sbin/amrctl/amrctl.c Fri May 18 13:47:33 2012 +0000
@@ -149,8 +149,6 @@
{ AMR_BATT_CHARGE_FAIL, "charge failed" }
};
-#define NTAB(tab) (sizeof tab / sizeof tab [0])
-
static int
amr_ioctl_enquiry(int fd, u_int8_t cmd, u_int8_t cmdsub, u_int8_t cmdqual)
{
@@ -269,7 +267,7 @@
char bios[100], firmware[100];
size_t i;
- for (i = 0; i < NTAB(prodtable); i++) {
+ for (i = 0; i < __arraycount(prodtable); i++) {
if (cardtype == prodtable[i].signature) {
product = prodtable[i].product;
break;
@@ -351,7 +349,7 @@
size_t i;
strcpy(buffer, "<");
- for (i = 0; i < NTAB(proptable); i++) {
+ for (i = 0; i < __arraycount(proptable); i++) {
if (i > 0)
strcat(buffer, ",");
if (prop & proptable[i].code)
@@ -373,7 +371,7 @@
(AMR_DRV_CURSTATE(state) == AMR_DRV_OFFLINE) && verbosity == 0)
return NULL;
- for (i = 0; i < NTAB(statetable); i++)
+ for (i = 0; i < __arraycount(statetable); i++)
if (AMR_DRV_CURSTATE(state) == statetable[i].code)
return (statetable[i].status);
@@ -399,13 +397,14 @@
if (bflags || globalparam) {
batt_status = ae3->ae_batterystatus;
printf("Battery status\t\t");
- for (i = 0; i < NTAB(battable); i++) {
+ for (i = 0; i < __arraycount(battable); i++) {
if (batt_status & battable[i].code)
printf("%s, ", battable[i].status);
}
if (!(batt_status &
(AMR_BATT_MODULE_MISSING|AMR_BATT_PACK_MISSING))) {
- for (i = 0; i < NTAB(bcstatble); i++)
+ for (i = 0;
+ i < __arraycount(bcstatble); i++)
if (bcstatble[i].code ==
(batt_status & AMR_BATT_CHARGE_MASK))
printf("%s", bcstatble[i].status);
Home |
Main Index |
Thread Index |
Old Index