summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-04-16 03:13:22 +0200
committerKay Sievers <kay@vrfy.org>2012-04-16 19:20:57 +0200
commit8fef0ff25c9fd7e5bb99d66f43c6357e4996a3cc (patch)
tree8b570d9685b12ad1210c9ed857c18fa4e2e00913 /src/udev
parentb59e246565337d6c6967059dd15a52a15277433e (diff)
udev: replace ARRAY_SIZE() with ELEMENTSOF()
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-builtin-firmware.c2
-rw-r--r--src/udev/udev-builtin.c10
-rw-r--r--src/udev/udev-event.c6
-rw-r--r--src/udev/udev-rules.c4
-rw-r--r--src/udev/udevadm-info.c2
-rw-r--r--src/udev/udevadm-monitor.c2
-rw-r--r--src/udev/udevadm.c4
-rw-r--r--src/udev/udevd.c6
8 files changed, 18 insertions, 18 deletions
diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c
index 146a57706f..5ba712c89d 100644
--- a/src/udev/udev-builtin-firmware.c
+++ b/src/udev/udev-builtin-firmware.c
@@ -99,7 +99,7 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo
/* lookup firmware file */
uname(&kernel);
- for (i = 0; i < ARRAY_SIZE(searchpath); i++) {
+ for (i = 0; i < ELEMENTSOF(searchpath); i++) {
util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL);
fwfile = fopen(fwpath, "re");
if (fwfile != NULL)
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
index 508a22ecf8..b8cdc708bc 100644
--- a/src/udev/udev-builtin.c
+++ b/src/udev/udev-builtin.c
@@ -44,7 +44,7 @@ int udev_builtin_init(struct udev *udev)
unsigned int i;
int err;
- for (i = 0; i < ARRAY_SIZE(builtins); i++) {
+ for (i = 0; i < ELEMENTSOF(builtins); i++) {
if (builtins[i]->init) {
err = builtins[i]->init(udev);
if (err < 0)
@@ -58,7 +58,7 @@ void udev_builtin_exit(struct udev *udev)
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(builtins); i++)
+ for (i = 0; i < ELEMENTSOF(builtins); i++)
if (builtins[i]->exit)
builtins[i]->exit(udev);
}
@@ -68,7 +68,7 @@ bool udev_builtin_validate(struct udev *udev)
unsigned int i;
bool change = false;
- for (i = 0; i < ARRAY_SIZE(builtins); i++)
+ for (i = 0; i < ELEMENTSOF(builtins); i++)
if (builtins[i]->validate)
if (builtins[i]->validate(udev))
change = true;
@@ -79,7 +79,7 @@ void udev_builtin_list(struct udev *udev)
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(builtins); i++)
+ for (i = 0; i < ELEMENTSOF(builtins); i++)
fprintf(stderr, " %-12s %s\n", builtins[i]->name, builtins[i]->help);
}
@@ -103,7 +103,7 @@ enum udev_builtin_cmd udev_builtin_lookup(const char *command)
pos = strchr(name, ' ');
if (pos)
pos[0] = '\0';
- for (i = 0; i < ARRAY_SIZE(builtins); i++)
+ for (i = 0; i < ELEMENTSOF(builtins); i++)
if (strcmp(builtins[i]->name, name) == 0)
return i;
return UDEV_BUILTIN_MAX;
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index bea316c18e..eab1bae27f 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -132,7 +132,7 @@ size_t udev_event_apply_format(struct udev_event *event, const char *src, char *
goto copy;
}
- for (i = 0; i < ARRAY_SIZE(map); i++) {
+ for (i = 0; i < ELEMENTSOF(map); i++) {
if (strncmp(&from[1], map[i].name, strlen(map[i].name)) == 0) {
type = map[i].type;
from += strlen(map[i].name)+1;
@@ -148,7 +148,7 @@ size_t udev_event_apply_format(struct udev_event *event, const char *src, char *
goto copy;
}
- for (i = 0; i < ARRAY_SIZE(map); i++) {
+ for (i = 0; i < ELEMENTSOF(map); i++) {
if (from[1] == map[i].fmt) {
type = map[i].type;
from += 2;
@@ -486,7 +486,7 @@ static void spawn_read(struct udev_event *event,
timeout = -1;
}
- fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout);
+ fdcount = epoll_wait(fd_ep, ev, ELEMENTSOF(ev), timeout);
if (fdcount < 0) {
if (errno == EINTR)
continue;
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 4e85760bd4..55d7e30c02 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1131,7 +1131,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
token->key.type = type;
token->key.op = op;
rule_tmp->token_cur++;
- if (rule_tmp->token_cur >= ARRAY_SIZE(rule_tmp->token)) {
+ if (rule_tmp->token_cur >= ELEMENTSOF(rule_tmp->token)) {
log_error("temporary rule array too small\n");
return -1;
}
@@ -1344,7 +1344,7 @@ static int add_rule(struct udev_rules *rules, char *line,
};
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(blacklist); i++)
+ for (i = 0; i < ELEMENTSOF(blacklist); i++)
if (strcmp(attr, blacklist[i]) == 0) {
log_error("invalid ENV attribute, '%s' can not be set %s:%u\n", attr, filename, lineno);
continue;
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index f392818c83..39221b7374 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -44,7 +44,7 @@ static bool skip_attribute(const char *name)
};
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(skip); i++)
+ for (i = 0; i < ELEMENTSOF(skip); i++)
if (strcmp(name, skip[i]) == 0)
return true;
return false;
diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c
index 6a202f04ca..1a6f71a465 100644
--- a/src/udev/udevadm-monitor.c
+++ b/src/udev/udevadm-monitor.c
@@ -253,7 +253,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[])
struct epoll_event ev[4];
int i;
- fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1);
+ fdcount = epoll_wait(fd_ep, ev, ELEMENTSOF(ev), -1);
if (fdcount < 0) {
if (errno != EINTR)
fprintf(stderr, "error receiving uevent message: %m\n");
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
index 55b5948aae..0858c37be8 100644
--- a/src/udev/udevadm.c
+++ b/src/udev/udevadm.c
@@ -67,7 +67,7 @@ static int adm_help(struct udev *udev, int argc, char *argv[])
unsigned int i;
fprintf(stderr, "Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n");
- for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++)
+ for (i = 0; i < ELEMENTSOF(udevadm_cmds); i++)
if (udevadm_cmds[i]->help != NULL)
printf(" %-12s %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help);
fprintf(stderr, "\n");
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
log_debug("runtime dir '%s'\n", udev_get_run_path(udev));
if (command != NULL)
- for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) {
+ for (i = 0; i < ELEMENTSOF(udevadm_cmds); i++) {
if (strcmp(udevadm_cmds[i]->name, command) == 0) {
argc -= optind;
argv += optind;
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 97b910cc2e..24f0bf6d1e 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -327,7 +327,7 @@ static void worker_new(struct event *event)
int fdcount;
int i;
- fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1);
+ fdcount = epoll_wait(fd_ep, ev, ELEMENTSOF(ev), -1);
if (fdcount < 0) {
if (errno == EINTR)
continue;
@@ -889,7 +889,7 @@ static void static_dev_create_links(struct udev *udev)
if (dir == NULL)
return;
- for (i = 0; i < ARRAY_SIZE(stdlinks); i++) {
+ for (i = 0; i < ELEMENTSOF(stdlinks); i++) {
struct stat sb;
if (stat(stdlinks[i].target, &sb) == 0) {
@@ -1496,7 +1496,7 @@ int main(int argc, char *argv[])
/* kill idle or hanging workers */
timeout = 3 * 1000;
}
- fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout);
+ fdcount = epoll_wait(fd_ep, ev, ELEMENTSOF(ev), timeout);
if (fdcount < 0)
continue;