From 9637e70133b6edfba4a37bde22909ee6e9d21ede Mon Sep 17 00:00:00 2001 From: Garrett Cooper Date: Sat, 18 May 2013 17:47:21 -0700 Subject: [PATCH] Synch __arraycount with upstream's definition Subsequently, fix a -Wsign-compare error with clang due to synching __arraycount's definition. Signed-off-by: Garrett Cooper --- usr.sbin/bluetooth/btpand/btpand.c | 4 ++-- usr.sbin/bluetooth/btpand/btpand.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bluetooth/btpand/btpand.c b/usr.sbin/bluetooth/btpand/btpand.c index 9387444..8895db2 100644 --- a/usr.sbin/bluetooth/btpand/btpand.c +++ b/usr.sbin/bluetooth/btpand/btpand.c @@ -146,7 +146,7 @@ main(int argc, char *argv[]) case 's': /* service */ case 'S': /* service (no SDP) */ for (ul = 0; strcasecmp(optarg, services[ul].name); ul++) { - if (ul == __arraycount(services)) + if (ul == (unsigned long)__arraycount(services)) errx(EXIT_FAILURE, "%s: unknown service", optarg); } @@ -264,7 +264,7 @@ static void usage(void) { const char *p = getprogname(); - int n = strlen(p); + size_t n = strlen(p); fprintf(stderr, "usage: %s [-i ifname] [-m mode] -a address -d device\n" diff --git a/usr.sbin/bluetooth/btpand/btpand.h b/usr.sbin/bluetooth/btpand/btpand.h index c5f7204..440cca1 100644 --- a/usr.sbin/bluetooth/btpand/btpand.h +++ b/usr.sbin/bluetooth/btpand/btpand.h @@ -44,7 +44,7 @@ #include "event.h" #ifndef __arraycount -#define __arraycount(__x) (int)(sizeof((__x)) / sizeof((__x)[0])) +#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) #endif #ifndef L2CAP_PSM_INVALID -- 1.8.2.3