From: Alan Jenkins Date: Tue, 28 Oct 2008 08:58:18 +0000 (+0000) Subject: udevd: simplify rules execution loop X-Git-Tag: 174~1368 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6270756cdca967adce6badaf1360d872a0907bf0;p=systemd udevd: simplify rules execution loop cur can't become NULL, and the check for TK_END can be folded into the switch statement. Signed-off-by: Alan Jenkins --- diff --git a/udev/udev-rules.c b/udev/udev-rules.c index a6f92203..665ad71e 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1843,7 +1843,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* loop through token list, match, run actions or forward to next rule */ cur = &rules->tokens[0]; rule = cur; - while (cur != NULL && cur->type != TK_END) { + while (1) { unsigned int idx; dump_token(rules, cur); @@ -2319,11 +2319,11 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event cur = &rules->tokens[cur->key.rule_goto]; continue; case TK_A_LAST_RULE: + case TK_END: break; case TK_M_PARENTS_MAX: case TK_M_MAX: - case TK_END: case TK_UNSET: err(rules->udev, "wrong type %u\n", cur->type); goto nomatch;