From 80b8b39899a09c7516920cda5fd343b3086d4824 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 25 Jun 2007 10:55:35 +0000 Subject: Consolidate ARRAY_SIZE macro; remove one unneeded global var (walter harms ) --- applets/applets.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'applets') diff --git a/applets/applets.c b/applets/applets.c index cff792fb7..57c972f79 100644 --- a/applets/applets.c +++ b/applets/applets.c @@ -47,7 +47,6 @@ static const char usage_messages[] = "" /* Define struct bb_applet applets[] */ #include "applets.h" /* The -1 arises because of the {0,NULL,0,-1} entry. */ -const unsigned short NUM_APPLETS = sizeof(applets) / sizeof(applets[0]) - 1; const struct bb_applet *current_applet; const char *applet_name ATTRIBUTE_EXTERNALLY_VISIBLE; @@ -488,7 +487,7 @@ static int applet_name_compare(const void *name, const void *vapplet) const struct bb_applet *find_applet_by_name(const char *name) { /* Do a binary search to find the applet entry given the name. */ - return bsearch(name, applets, NUM_APPLETS, sizeof(applets[0]), + return bsearch(name, applets, ARRAY_SIZE(applets)-1, sizeof(applets[0]), applet_name_compare); } -- cgit v1.2.3