diff --git a/bin/named/server.c b/bin/named/server.c index 35ad6a0b7f..e39ad83b02 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -152,10 +152,6 @@ #define SIZE_AS_PERCENT ((size_t)-2) #endif /* ifndef SIZE_AS_PERCENT */ -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - #ifdef TUNE_LARGE #define RESOLVER_NTASKS_PERCPU 32 #else @@ -5829,7 +5825,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config, } name = dns_fixedname_initname(&fixed); - for (ipv4only_zone = 0; ipv4only_zone < ARRAYSIZE(zones); + for (ipv4only_zone = 0; ipv4only_zone < ARRAY_SIZE(zones); ipv4only_zone++) { dns_forwarders_t *dnsforwarders = NULL; diff --git a/lib/dns/rdata/in_1/svcb_64.c b/lib/dns/rdata/in_1/svcb_64.c index 068f93619b..12e8caae52 100644 --- a/lib/dns/rdata/in_1/svcb_64.c +++ b/lib/dns/rdata/in_1/svcb_64.c @@ -90,12 +90,7 @@ static isc_result_t svcb_validate(uint16_t key, isc_region_t *region) { size_t i; -#ifndef ARRAYSIZE -/* defined in winnt.h */ -#define ARRAYSIZE(x) (sizeof(x) / sizeof(*x)) -#endif - - for (i = 0; i < ARRAYSIZE(sbpr); i++) { + for (i = 0; i < ARRAY_SIZE(sbpr); i++) { if (sbpr[i].value == key) { switch (sbpr[i].encoding) { case sbpr_port: @@ -172,7 +167,7 @@ svc_keyfromregion(isc_textregion_t *region, char sep, uint16_t *value, unsigned long ul; /* Look for known key names. */ - for (i = 0; i < ARRAYSIZE(sbpr); i++) { + for (i = 0; i < ARRAY_SIZE(sbpr); i++) { size_t len = strlen(sbpr[i].name); if (strncasecmp(region->base, sbpr[i].name, len) != 0 || (region->base[len] != 0 && region->base[len] != sep)) @@ -235,7 +230,7 @@ svc_fromtext(isc_textregion_t *region, isc_buffer_t *target) { unsigned int used; unsigned long ul; - for (i = 0; i < ARRAYSIZE(sbpr); i++) { + for (i = 0; i < ARRAY_SIZE(sbpr); i++) { len = strlen(sbpr[i].name); if (strncmp(region->base, sbpr[i].name, len) != 0 || (region->base[len] != 0 && region->base[len] != '=')) @@ -360,7 +355,7 @@ svcparamkey(unsigned short value, enum encoding *encoding, char *buf, size_t i; int n; - for (i = 0; i < ARRAYSIZE(sbpr); i++) { + for (i = 0; i < ARRAY_SIZE(sbpr); i++) { if (sbpr[i].value == value && sbpr[i].initial) { *encoding = sbpr[i].encoding; return (sbpr[i].name); diff --git a/lib/isccfg/tests/parser_test.c b/lib/isccfg/tests/parser_test.c index e96881e8dd..b7ea3db2df 100644 --- a/lib/isccfg/tests/parser_test.c +++ b/lib/isccfg/tests/parser_test.c @@ -146,9 +146,7 @@ addzoneconf(void **state) { result = cfg_parser_create(mctx, lctx, &p); assert_int_equal(result, ISC_R_SUCCESS); -#define ARRAYSIZE(x) (sizeof(x) / sizeof(x[0])) - - for (size_t i = 0; i < ARRAYSIZE(tests); i++) { + for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { cfg_obj_t *conf = NULL; const cfg_obj_t *obj = NULL, *zlist = NULL;