hi list,
here is the ARRAY_SIZE patch. It replaces every size(arr)/size(arr[0])
and private defines with ARRAY_SIZE() as defined in linux/kernel.h.
Sometimes it was used only once so i placed it directly.
I have test-compiled the stuff against 1.6.0 vanilla.
note: i did no bloat check since this is a clean-up patch
re,
wh
diff -u -Nuar busybox-1.6.0.org/applets/applets.c busybox-1.6.0/applets/applets.c
--- busybox-1.6.0.org/applets/applets.c 2007-06-01 13:48:40.000000000 +0200
+++ busybox-1.6.0/applets/applets.c 2007-06-23 19:12:40.000000000 +0200
@@ -47,7 +47,6 @@
/* 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 @@
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);
}
diff -u -Nuar busybox-1.6.0.org/coreutils/od_bloaty.c busybox-1.6.0/coreutils/od_bloaty.c
--- busybox-1.6.0.org/coreutils/od_bloaty.c 2007-06-01 13:48:34.000000000 +0200
+++ busybox-1.6.0/coreutils/od_bloaty.c 2007-06-23 19:20:55.000000000 +0200
@@ -158,7 +158,7 @@
initializer in the width_bytes array. */
struct dummy {
int assert_width_bytes_matches_size_spec_decl
- [sizeof width_bytes / sizeof width_bytes[0] == N_SIZE_SPECS ? 1 : -1];
+ [ ARRAY_SIZE( width_bytes ) == N_SIZE_SPECS ? 1 : -1];
};
static size_t string_min;
diff -u -Nuar busybox-1.6.0.org/coreutils/stty.c busybox-1.6.0/coreutils/stty.c
--- busybox-1.6.0.org/coreutils/stty.c 2007-06-01 13:48:34.000000000 +0200
+++ busybox-1.6.0/coreutils/stty.c 2007-06-23 19:25:10.000000000 +0200
@@ -319,7 +319,7 @@
};
enum {
- NUM_mode_info = (sizeof(mode_info) / sizeof(mode_info[0]))
+ NUM_mode_info = ( ARRAY_SIZE(mode_info) )
};
/* Control character settings */
@@ -371,7 +371,7 @@
};
enum {
- NUM_control_info = (sizeof(control_info) / sizeof(control_info[0]))
+ NUM_control_info = ( ARRAY_SIZE(control_info) )
};
/* The width of the screen, for output wrapping */
diff -u -Nuar busybox-1.6.0.org/coreutils/test.c busybox-1.6.0/coreutils/test.c
--- busybox-1.6.0.org/coreutils/test.c 2007-06-01 13:48:34.000000000 +0200
+++ busybox-1.6.0/coreutils/test.c 2007-06-23 19:22:32.000000000 +0200
@@ -146,7 +146,6 @@
{ ")" , RPAREN , PAREN },
};
-enum { NUM_OPS = sizeof(ops) / sizeof(ops[0]) };
#if ENABLE_FEATURE_TEST_64
typedef int64_t arith_t;
@@ -463,7 +462,7 @@
return op->op_num;
}
op++;
- } while (op < ops + NUM_OPS);
+ } while (op < ops + ARRAY_SIZE(ops));
return OPERAND;
}
diff -u -Nuar busybox-1.6.0.org/editors/awk.c busybox-1.6.0/editors/awk.c
--- busybox-1.6.0.org/editors/awk.c 2007-06-01 13:48:40.000000000 +0200
+++ busybox-1.6.0/editors/awk.c 2007-06-23 20:10:29.000000000 +0200
@@ -390,7 +390,7 @@
/* hash size may grow to these values */
#define FIRST_PRIME 61;
static const unsigned PRIMES[] = { 251, 1021, 4093, 16381, 65521 };
-enum { NPRIMES = sizeof(PRIMES) / sizeof(PRIMES[0]) };
+
/* globals */
@@ -503,7 +503,7 @@
unsigned newsize, i, idx;
hash_item **newitems, *hi, *thi;
- if (hash->nprime == NPRIMES)
+ if (hash->nprime == ARRAY_SIZE(PRIMES) )
return;
newsize = PRIMES[hash->nprime++];
diff -u -Nuar busybox-1.6.0.org/include/libbb.h busybox-1.6.0/include/libbb.h
--- busybox-1.6.0.org/include/libbb.h 2007-06-01 13:48:39.000000000 +0200
+++ busybox-1.6.0/include/libbb.h 2007-06-23 19:03:49.000000000 +0200
@@ -1055,4 +1055,7 @@
#include <dmalloc.h>
#endif
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
#endif /* __LIBBUSYBOX_H__ */
diff -u -Nuar busybox-1.6.0.org/libbb/u_signal_names.c busybox-1.6.0/libbb/u_signal_names.c
--- busybox-1.6.0.org/libbb/u_signal_names.c 2007-06-01 13:48:35.000000000 +0200
+++ busybox-1.6.0/libbb/u_signal_names.c 2007-06-23 19:29:35.000000000 +0200
@@ -127,7 +127,7 @@
return i;
if (strncasecmp(name, "SIG", 3) == 0)
name += 3;
- for (i = 0; i < sizeof(signals) / sizeof(signals[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(signals) ; i++)
if (strcasecmp(name, signals[i]) == 0)
return i;
@@ -152,7 +152,7 @@
const char *get_signame(int number)
{
- if ((unsigned)number < sizeof(signals) / sizeof(signals[0])) {
+ if ( (unsigned)number < ARRAY_SIZE(signals) ) {
if (signals[number][0]) /* if it's not an empty str */
return signals[number];
}
diff -u -Nuar busybox-1.6.0.org/miscutils/crond.c busybox-1.6.0/miscutils/crond.c
--- busybox-1.6.0.org/miscutils/crond.c 2007-06-01 13:48:38.000000000 +0200
+++ busybox-1.6.0/miscutils/crond.c 2007-06-23 19:31:26.000000000 +0200
@@ -15,7 +15,6 @@
#include "libbb.h"
#include <sys/syslog.h>
-#define arysize(ary) (sizeof(ary)/sizeof((ary)[0]))
#ifndef CRONTABS
#define CRONTABS "/var/spool/cron/crontabs"
@@ -468,13 +467,13 @@
int weekUsed = 0;
int daysUsed = 0;
- for (i = 0; i < (int)(arysize(line->cl_Dow)); ++i) {
+ for (i = 0; i < (int)(ARRAY_SIZE(line->cl_Dow)); ++i) {
if (line->cl_Dow[i] == 0) {
weekUsed = 1;
break;
}
}
- for (i = 0; i < (int)(arysize(line->cl_Days)); ++i) {
+ for (i = 0; i < (int)(ARRAY_SIZE(line->cl_Days)); ++i) {
if (line->cl_Days[i] == 0) {
daysUsed = 1;
break;
diff -u -Nuar busybox-1.6.0.org/modutils/insmod.c busybox-1.6.0/modutils/insmod.c
--- busybox-1.6.0.org/modutils/insmod.c 2007-06-01 13:48:31.000000000 +0200
+++ busybox-1.6.0/modutils/insmod.c 2007-06-23 19:33:01.000000000 +0200
@@ -3632,7 +3632,7 @@
int i;
if (license)
*license = value+1;
- for (i = 0; i < sizeof(gpl_licenses)/sizeof(gpl_licenses[0]); ++i) {
+ for (i = 0; i < ARRAY_SIZE(gpl_licenses); ++i) {
if (strcmp(value+1, gpl_licenses[i]) == 0)
return 0;
}
@@ -3831,7 +3831,7 @@
#endif /* _NOT_SUPPORTED_ */
/* tag the desired sections if size is non-zero */
- for (i = 0; i < sizeof(section_names)/sizeof(section_names[0]); ++i) {
+ for (i = 0; i < ARRAY_SIZE(section_names); ++i) {
sec = obj_find_section(f, section_names[i]);
if (sec && sec->header.sh_size) {
l = sizeof(symprefix)+ /* "__insmod_" */
diff -u -Nuar busybox-1.6.0.org/networking/httpd.c busybox-1.6.0/networking/httpd.c
--- busybox-1.6.0.org/networking/httpd.c 2007-06-01 13:48:29.000000000 +0200
+++ busybox-1.6.0/networking/httpd.c 2007-06-23 19:46:49.000000000 +0200
@@ -848,11 +848,8 @@
time_t timer = time(0);
char timeStr[80];
int len;
- enum {
- numNames = sizeof(httpResponseNames) / sizeof(httpResponseNames[0])
- };
- for (i = 0; i < numNames; i++) {
+ for (i = 0; i < ARRAY_SIZE(httpResponseNames); i++) {
if (httpResponseNames[i].type == responseNum) {
responseString = httpResponseNames[i].name;
infoString = httpResponseNames[i].info;
diff -u -Nuar busybox-1.6.0.org/networking/ifconfig.c busybox-1.6.0/networking/ifconfig.c
--- busybox-1.6.0.org/networking/ifconfig.c 2007-06-01 13:48:29.000000000 +0200
+++ busybox-1.6.0/networking/ifconfig.c 2007-06-23 19:39:45.000000000 +0200
@@ -337,7 +337,7 @@
}
/* We fell through, so treat as possible hostname. */
- a1op = Arg1Opt + (sizeof(Arg1Opt) / sizeof(Arg1Opt[0])) - 1;
+ a1op = Arg1Opt + ARRAY_SIZE(Arg1Opt) - 1;
mask = op->arg_flags;
goto HOSTNAME;
diff -u -Nuar busybox-1.6.0.org/networking/ifupdown.c busybox-1.6.0/networking/ifupdown.c
--- busybox-1.6.0.org/networking/ifupdown.c 2007-06-01 13:48:29.000000000 +0200
+++ busybox-1.6.0/networking/ifupdown.c 2007-06-23 19:37:47.000000000 +0200
@@ -471,8 +471,8 @@
static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
{
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
- int i, nclients = sizeof(ext_dhcp_clients) / sizeof(ext_dhcp_clients[0]);
- for (i = 0; i < nclients; i++) {
+ int i ;
+ for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
if (exists_execable(ext_dhcp_clients[i].name))
return execute(ext_dhcp_clients[i].startcmd, ifd, exec);
}
@@ -490,8 +490,8 @@
static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
{
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
- int i, nclients = sizeof(ext_dhcp_clients) / sizeof(ext_dhcp_clients[0]);
- for (i = 0; i < nclients; i++) {
+ int i ;
+ for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
if (exists_execable(ext_dhcp_clients[i].name))
return execute(ext_dhcp_clients[i].stopcmd, ifd, exec);
}
diff -u -Nuar busybox-1.6.0.org/networking/libiproute/ll_proto.c busybox-1.6.0/networking/libiproute/ll_proto.c
--- busybox-1.6.0.org/networking/libiproute/ll_proto.c 2007-06-01 13:48:28.000000000 +0200
+++ busybox-1.6.0/networking/libiproute/ll_proto.c 2007-06-23 19:42:47.000000000 +0200
@@ -96,7 +96,7 @@
id = ntohs(id);
- for (i=0; i<sizeof(llproto_names)/sizeof(llproto_names[0]); i++) {
+ for (i=0; i<ARRAY_SIZE(llproto_names); i++) {
if (llproto_names[i].id == id)
return llproto_names[i].name;
}
@@ -107,7 +107,7 @@
int ll_proto_a2n(unsigned short *id, char *buf)
{
int i;
- for (i=0; i<sizeof(llproto_names)/sizeof(llproto_names[0]); i++) {
+ for (i=0; i<ARRAY_SIZE(llproto_names); i++) {
if (strcasecmp(llproto_names[i].name, buf) == 0) {
*id = htons(llproto_names[i].id);
return 0;
diff -u -Nuar busybox-1.6.0.org/networking/libiproute/ll_types.c busybox-1.6.0/networking/libiproute/ll_types.c
--- busybox-1.6.0.org/networking/libiproute/ll_types.c 2007-06-01 13:48:28.000000000 +0200
+++ busybox-1.6.0/networking/libiproute/ll_types.c 2007-06-23 19:41:24.000000000 +0200
@@ -108,7 +108,7 @@
#undef __PF
int i;
- for (i = 0; i < sizeof(arphrd_names)/sizeof(arphrd_names[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(arphrd_names); i++) {
if (arphrd_names[i].type == type)
return arphrd_names[i].name;
}
diff -u -Nuar busybox-1.6.0.org/networking/tftp.c busybox-1.6.0/networking/tftp.c
--- busybox-1.6.0.org/networking/tftp.c 2007-06-01 13:48:29.000000000 +0200
+++ busybox-1.6.0/networking/tftp.c 2007-06-23 19:44:39.000000000 +0200
@@ -280,13 +280,13 @@
"no such user",
"bad option",
};
- enum { NUM_ERRCODE = sizeof(errcode_str) / sizeof(errcode_str[0]) };
+
const char *msg = "";
if (rbuf[4] != '\0') {
msg = &rbuf[4];
rbuf[tftp_bufsize - 1] = '\0';
- } else if (recv_blk < NUM_ERRCODE) {
+ } else if (recv_blk <ARRAY_SIZE(errcode_str)) {
msg = errcode_str[recv_blk];
}
bb_error_msg("server error: (%u) %s", recv_blk, msg);
diff -u -Nuar busybox-1.6.0.org/procps/ps.c busybox-1.6.0/procps/ps.c
--- busybox-1.6.0.org/procps/ps.c 2007-06-01 13:48:40.000000000 +0200
+++ busybox-1.6.0/procps/ps.c 2007-06-23 20:43:58.000000000 +0200
@@ -118,8 +118,6 @@
{ 4 , "rss" ,"RSS" ,func_rss ,PSSCAN_RSS },
};
-#define VEC_SIZE(v) ( sizeof(v) / sizeof((v)[0]) )
-
#define DEFAULT_O_STR "pid,user" /* TODO: ,vsz,stat */ ",args"
struct globals {
@@ -150,7 +148,7 @@
static const ps_out_t* find_out_spec(const char *name)
{
int i;
- for (i = 0; i < VEC_SIZE(out_spec); i++) {
+ for (i = 0; i < ARRAY_SIZE(out_spec); i++) {
if (!strcmp(name, out_spec[i].name))
return &out_spec[i];
}
diff -u -Nuar busybox-1.6.0.org/shell/ash.c busybox-1.6.0/shell/ash.c
--- busybox-1.6.0.org/shell/ash.c 2007-06-01 13:48:33.000000000 +0200
+++ busybox-1.6.0/shell/ash.c 2007-06-23 20:33:49.000000000 +0200
@@ -101,7 +101,8 @@
#define optletters(n) optletters_optnames[(n)][0]
#define optnames(n) (&optletters_optnames[(n)][1])
-#define NOPTS (sizeof(optletters_optnames)/sizeof(optletters_optnames[0]))
+//#define NOPTS (sizeof(optletters_optnames)/sizeof(optletters_optnames[0]))
+enum { NOPTS=ARRAY_SIZE(optletters_optnames) };
static char optlist[NOPTS];
@@ -1839,7 +1840,7 @@
vps1.text = "PS1=# ";
#endif
vp = varinit;
- end = vp + sizeof(varinit) / sizeof(varinit[0]);
+ end = vp + ARRAY_SIZE(varinit);
do {
vpp = hashvar(vp->text);
vp->next = *vpp;
@@ -8096,7 +8097,6 @@
{ BUILTIN_REGULAR "wait", waitcmd },
};
-#define NUMBUILTINS (sizeof(builtintab) / sizeof(builtintab[0]))
#define COMMANDCMD (builtintab + 5 + \
2 * ENABLE_ASH_BUILTIN_TEST + \
@@ -8116,9 +8116,11 @@
find_builtin(const char *name)
{
struct builtincmd *bp;
-
+ /*
+ CHECK: ARRAY_SIZE(builtintab)-1 is correct
+ */
bp = bsearch(
- name, builtintab, NUMBUILTINS, sizeof(builtintab[0]),
+ name, builtintab, ARRAY_SIZE(builtintab) , sizeof(builtintab[0]),
pstrcmp
);
return bp;
@@ -11257,7 +11259,7 @@
int col, i;
out1fmt("\nBuilt-in commands:\n-------------------\n");
- for (col = 0, i = 0; i < NUMBUILTINS; i++) {
+ for (col = 0, i = 0; i < ARRAY_SIZE(builtintab) ; i++) {
col += out1fmt("%c%s", ((col == 0) ? '\t' : ' '),
builtintab[i].name + 1);
if (col > 60) {
diff -u -Nuar busybox-1.6.0.org/shell/hush.c busybox-1.6.0/shell/hush.c
--- busybox-1.6.0.org/shell/hush.c 2007-06-01 13:48:33.000000000 +0200
+++ busybox-1.6.0/shell/hush.c 2007-06-23 19:55:23.000000000 +0200
@@ -2899,10 +2899,10 @@
{ "done", RES_DONE, FLAG_END }
#endif
};
- enum { NRES = sizeof(reserved_list)/sizeof(reserved_list[0]) };
+
const struct reserved_combo *r;
- for (r = reserved_list; r < reserved_list + NRES; r++) {
+ for (r = reserved_list; r < reserved_list + ARRAY_SIZE(reserved_list); r++) {
if (strcmp(dest->data, r->literal) != 0)
continue;
debug_printf("found reserved word %s, code %d\n", r->literal, r->code);
diff -u -Nuar busybox-1.6.0.org/shell/lash.c busybox-1.6.0/shell/lash.c
--- busybox-1.6.0.org/shell/lash.c 2007-06-01 13:48:33.000000000 +0200
+++ busybox-1.6.0/shell/lash.c 2007-06-23 19:57:01.000000000 +0200
@@ -146,8 +146,8 @@
/* to do: add ulimit */
};
-#define VEC_SIZE(v) (sizeof(v)/sizeof(v[0]))
-#define VEC_LAST(v) v[VEC_SIZE(v)-1]
+
+#define VEC_LAST(v) v[ARRAY_SIZE(v)-1]
static int shell_context; /* Type prompt trigger (PS1 or PS2) */
diff -u -Nuar busybox-1.6.0.org/shell/msh.c busybox-1.6.0/shell/msh.c
--- busybox-1.6.0.org/shell/msh.c 2007-06-01 13:48:33.000000000 +0200
+++ busybox-1.6.0/shell/msh.c 2007-06-23 19:54:11.000000000 +0200
@@ -596,7 +596,7 @@
"Terminated",
};
-#define NSIGNAL (sizeof(signame)/sizeof(signame[0]))
+
struct res {
const char *r_name;
@@ -2997,7 +2997,7 @@
} else {
rv = WAITSIG(s);
if (rv != 0) {
- if (rv < NSIGNAL) {
+ if (rv < ARRAY_SIZE(signame)) {
if (signame[rv] != NULL) {
if (pid != lastpid) {
prn(pid);
@@ -3016,7 +3016,7 @@
}
if (WAITCORE(s))
prs(" - core dumped");
- if (rv >= NSIGNAL || signame[rv])
+ if (rv >= ARRAY_SIZE(signame) || signame[rv])
prs("\n");
rv = -1;
} else
diff -u -Nuar busybox-1.6.0.org/util-linux/fdisk.c busybox-1.6.0/util-linux/fdisk.c
--- busybox-1.6.0.org/util-linux/fdisk.c 2007-06-01 13:48:41.000000000 +0200
+++ busybox-1.6.0/util-linux/fdisk.c 2007-06-23 19:58:18.000000000 +0200
@@ -16,8 +16,6 @@
# define USE_FEATURE_FDISK_BLKSIZE(a)
#endif
-#define SIZE(a) (sizeof(a)/sizeof((a)[0]))
-
#define DEFAULT_SECTOR_SIZE 512
#define MAX_SECTOR_SIZE 2048
#define SECTOR_SIZE 512 /* still used in osf/sgi/sun code */
diff -u -Nuar busybox-1.6.0.org/util-linux/fdisk_osf.c busybox-1.6.0/util-linux/fdisk_osf.c
--- busybox-1.6.0.org/util-linux/fdisk_osf.c 2007-06-01 13:48:41.000000000 +0200
+++ busybox-1.6.0/util-linux/fdisk_osf.c 2007-06-23 20:17:18.000000000 +0200
@@ -163,7 +163,7 @@
"floppy",
0
};
-#define BSD_DKMAXTYPES (sizeof(xbsd_dktypenames) / sizeof(xbsd_dktypenames[0]) - 1)
+
/*
* Filesystem type and version.
@@ -219,7 +219,7 @@
"\x10" "AdvFS", /* BSD_FS_ADVFS */
NULL
};
-#define BSD_FSMAXTYPES (SIZE(xbsd_fstypes)-1)
+//#define BSD_FSMAXTYPES (SIZE(xbsd_fstypes)-1)
/*
@@ -509,7 +509,7 @@
#else
printf("# %s:\n", partname(disk_device, xbsd_part_index+1, 0));
#endif
- if ((unsigned) lp->d_type < BSD_DKMAXTYPES)
+ if ((unsigned) lp->d_type < ARRAY_SIZE(xbsd_dktypenames)-1)
printf("type: %s\n", xbsd_dktypenames[lp->d_type]);
else
printf("type: %d\n", lp->d_type);
@@ -571,7 +571,7 @@
);
}
- if ((unsigned) pp->p_fstype < BSD_FSMAXTYPES)
+ if ((unsigned) pp->p_fstype < ARRAY_SIZE(xbsd_fstypes)-1)
printf("%8.8s", xbsd_fstypes[pp->p_fstype]);
else
printf("%8x", pp->p_fstype);
diff -u -Nuar busybox-1.6.0.org/util-linux/fdisk_sun.c busybox-1.6.0/util-linux/fdisk_sun.c
--- busybox-1.6.0.org/util-linux/fdisk_sun.c 2007-06-01 13:48:41.000000000 +0200
+++ busybox-1.6.0/util-linux/fdisk_sun.c 2007-06-23 20:18:48.000000000 +0200
@@ -207,7 +207,7 @@
if (!q)
break;
*q = '\0';
- for (i = 0; i < SIZE(sun_drives); i++) {
+ for (i = 0; i < ARRAY_SIZE(sun_drives); i++) {
if (*sun_drives[i].vendor && strcasecmp(sun_drives[i].vendor, vendor))
continue;
if (!strstr(model, sun_drives[i].model))
@@ -244,7 +244,7 @@
puts("Drive type\n"
" ? auto configure\n"
" 0 custom (with hardware detected defaults)");
- for (i = 0; i < SIZE(sun_drives); i++) {
+ for (i = 0; i < ARRAY_SIZE(sun_drives); i++) {
printf(" %c %s%s%s\n",
i + 'a', sun_drives[i].vendor,
(*sun_drives[i].vendor) ? " " : "",
@@ -255,11 +255,11 @@
if (c == '0') {
break;
}
- if (c >= 'a' && c < 'a' + SIZE(sun_drives)) {
+ if (c >= 'a' && c < 'a' + ARRAY_SIZE(sun_drives)) {
p = sun_drives + c - 'a';
break;
}
- if (c >= 'A' && c < 'A' + SIZE(sun_drives)) {
+ if (c >= 'A' && c < 'A' + ARRAY_SIZE(sun_drives)) {
p = sun_drives + c - 'A';
break;
}
@@ -446,7 +446,7 @@
else
array[i] = -1;
}
- qsort(array,SIZE(array),sizeof(array[0]),
+ qsort(array,ARRAY_SIZE(array),sizeof(array[0]),
(int (*)(const void *,const void *)) verify_sun_cmp);
if (array[0] == -1) {
printf("No partitions defined\n");
diff -u -Nuar busybox-1.6.0.org/util-linux/mount.c busybox-1.6.0/util-linux/mount.c
--- busybox-1.6.0.org/util-linux/mount.c 2007-06-01 13:48:41.000000000 +0200
+++ busybox-1.6.0/util-linux/mount.c 2007-06-23 20:00:25.000000000 +0200
@@ -120,7 +120,6 @@
{"remount", MS_REMOUNT}, // action flag
};
-#define VECTOR_SIZE(v) (sizeof(v) / sizeof((v)[0]))
/* Append mount options to string */
static void append_mount_options(char **oldopts, const char *newopts)
@@ -168,7 +167,7 @@
if (comma) *comma = 0;
// Find this option in mount_options
- for (i = 0; i < VECTOR_SIZE(mount_options); i++) {
+ for (i = 0; i < ARRAY_SIZE(mount_options); i++) {
if (!strcasecmp(mount_options[i].name, options)) {
long fl = mount_options[i].flags;
if (fl < 0) flags &= fl;
@@ -177,7 +176,7 @@
}
}
// If unrecognized not NULL, append unrecognized mount options */
- if (unrecognized && i == VECTOR_SIZE(mount_options)) {
+ if (unrecognized && i == ARRAY_SIZE(mount_options)) {
// Add it to strflags, to pass on to kernel
i = *unrecognized ? strlen(*unrecognized) : 0;
*unrecognized = xrealloc(*unrecognized, i+strlen(options)+2);
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox