diff options
author | Elliott Hughes <enh@google.com> | 2019-03-03 22:42:26 -0800 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-03-04 07:30:47 -0600 |
commit | 6d1eb1ce40801323b65401a70ae5f9782939eeb4 (patch) | |
tree | d94f6577702a8b626c3a4d4e1d1991868681cdda /toys | |
parent | 9be2e85165c3b93c87f63209c3597559333b1fc3 (diff) | |
download | toybox-6d1eb1ce40801323b65401a70ae5f9782939eeb4.tar.gz |
Consistently use ARRAY_LEN.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/other/blkid.c | 2 | ||||
-rw-r--r-- | toys/other/modinfo.c | 6 | ||||
-rw-r--r-- | toys/pending/host.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/toys/other/blkid.c b/toys/other/blkid.c index b791fa62..38559981 100644 --- a/toys/other/blkid.c +++ b/toys/other/blkid.c @@ -80,7 +80,7 @@ static void do_blkid(int fd, char *name) if (len != sizeof(toybuf)) return; // Iterate through types in range - for (i=0; i < sizeof(fstypes)/sizeof(struct fstype); i++) { + for (i=0; i<ARRAY_LEN(fstypes); i++) { uint64_t test; // Skip tests not in this 4k block diff --git a/toys/other/modinfo.c b/toys/other/modinfo.c index 126d1d63..eaf6cb98 100644 --- a/toys/other/modinfo.c +++ b/toys/other/modinfo.c @@ -51,18 +51,18 @@ static void modinfo_file(char *full_name) if (!buf) { perror_msg_raw(full_name); return; - } + } output_field("filename", full_name); for (pos = buf; pos < buf+len; pos++) { if (*pos) continue; - for (i = 0; i < sizeof(modinfo_tags) / sizeof(*modinfo_tags); i++) { + for (i=0; i<ARRAY_LEN(modinfo_tags); i++) { char *str = modinfo_tags[i]; int len = strlen(str); - if (!strncmp(pos+1, str, len) && pos[len+1] == '=') + if (!strncmp(pos+1, str, len) && pos[len+1] == '=') output_field(str, pos+len+2); } } diff --git a/toys/pending/host.c b/toys/pending/host.c index 96daf8e8..fa830a7d 100644 --- a/toys/pending/host.c +++ b/toys/pending/host.c @@ -103,7 +103,7 @@ void host_main(void) if (TT.type_str[0]-'0' < 10u) type = atoi(TT.type_str); else { type = -1; - for (i=0; i < sizeof rrt / sizeof *rrt; i++) { + for (i=0; i<ARRAY_LEN(rrt); i++) { if (rrt[i].name && !strcasecmp(TT.type_str, rrt[i].name)) { type = i; break; |