From: Kay Sievers Date: Thu, 27 May 2010 13:11:00 +0000 (+0200) Subject: while (1) -> for (;;) X-Git-Tag: 174~473 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88cbfb09ee5510277503ff1830ecc3aa6c380b00;p=systemd while (1) -> for (;;) --- diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index d305db65..be8804bd 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -243,7 +243,7 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) if (queue_file == NULL) return 0; - while (1) { + for (;;) { unsigned long long int seqnum; ssize_t devpath_len; @@ -435,7 +435,7 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev if (queue_file == NULL) return NULL; - while (1) { + for (;;) { char syspath[UTIL_PATH_SIZE]; char *s; size_t l; diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 8c535125..7d28b23b 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -84,7 +84,7 @@ int util_delete_path(struct udev *udev, const char *path) if (pos == p || pos == NULL) return 0; - while (1) { + for (;;) { *pos = '\0'; pos = strrchr(p, '/'); diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c index 34b3de86..3eb34494 100644 --- a/libudev/test-libudev.c +++ b/libudev/test-libudev.c @@ -242,7 +242,7 @@ static int test_monitor(struct udev *udev) fd = udev_monitor_get_fd(udev_monitor); FD_ZERO(&readfds); - while (1) { + for (;;) { struct udev_device *device; int fdcount; @@ -422,7 +422,7 @@ int main(int argc, char *argv[]) udev_set_log_fn(udev, log_fn); printf("set log: %p\n", log_fn); - while (1) { + for (;;) { int option; option = getopt_long(argc, argv, "+dhV", options, NULL); diff --git a/udev/udev-event.c b/udev/udev-event.c index 9c2ce1d3..44e24313 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -111,7 +111,7 @@ size_t udev_event_apply_format(struct udev_event *event, const char *src, char * s = dest; l = size; - while (1) { + for (;;) { enum subst_type type = SUBST_UNKNOWN; char attrbuf[UTIL_PATH_SIZE]; char *attr = NULL; diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 00b88d96..11948cac 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -894,7 +894,7 @@ static int get_key(struct udev *udev, char **line, char **key, enum operation_ty return -1; *key = linepos; - while (1) { + for (;;) { linepos++; if (linepos[0] == '\0') return -1; @@ -1180,7 +1180,7 @@ static int add_rule(struct udev_rules *rules, char *line, rule_tmp.rule.rule.filename_line = lineno; linepos = line; - while (1) { + for (;;) { char *key; char *value; enum operation_type op; @@ -1707,7 +1707,7 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis return -1; } - while (1) { + for (;;) { struct dirent *dent; dent = readdir(dir); @@ -1940,7 +1940,7 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * split = &rules->buf[token->key.value_off]; len = strlen(val); - while (1) { + for (;;) { const char *next; next = strchr(split, '|'); @@ -2182,7 +2182,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* loop over parents */ event->dev_parent = event->dev; - while (1) { + for (;;) { struct token *key; dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 0fd69b9a..4303aeb5 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -66,7 +66,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) if (uctrl == NULL) return 2; - while (1) { + for (;;) { int option; int i; char *endp; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index b395ad93..14baa6ac 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -238,7 +238,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) QUERY_ALL, } query = QUERY_NONE; - while (1) { + for (;;) { int option; struct stat statbuf; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index fb650846..85252bb7 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -92,7 +92,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) udev_list_init(&subsystem_match_list); udev_list_init(&tag_match_list); - while (1) { + for (;;) { option = getopt_long(argc, argv, "pekus:t:h", options, NULL); if (option == -1) break; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 4f422f90..1423cec6 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -84,7 +84,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) sigaddset(&mask, SIGALRM); sigprocmask(SIG_UNBLOCK, &mask, NULL); - while (1) { + for (;;) { int option; int seconds; @@ -181,7 +181,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } } - while (1) { + for (;;) { struct stat statbuf; const struct timespec duration = { 0 , 1000 * 1000 * 1000 / LOOP_PER_SECOND }; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 89462007..4db70c49 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -50,7 +50,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) info(udev, "version %s\n", VERSION); - while (1) { + for (;;) { int option; option = getopt_long(argc, argv, "a:s:fh", options, NULL); diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 3cb07dda..481e9cf1 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -122,7 +122,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) goto exit; } - while (1) { + for (;;) { int option; const char *key; const char *val; diff --git a/udev/udevadm.c b/udev/udevadm.c index 21b7f616..19b89ad0 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) udev_set_log_fn(udev, log_fn); udev_selinux_init(udev); - while (1) { + for (;;) { int option; option = getopt_long(argc, argv, "+dhV", options, NULL); diff --git a/udev/udevd.c b/udev/udevd.c index 802153b2..b48a9139 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -536,7 +536,7 @@ static void events_start(struct udev *udev) static void worker_returned(void) { - while (1) { + for (;;) { struct worker_message msg; ssize_t size; struct udev_list_node *loop; @@ -709,7 +709,7 @@ static void handle_signal(struct udev *udev, int signo) udev_exit = true; break; case SIGCHLD: - while (1) { + for (;;) { pid_t pid; int status; struct udev_list_node *loop, *tmp; @@ -975,7 +975,7 @@ int main(int argc, char *argv[]) info(udev, "version %s\n", VERSION); udev_selinux_init(udev); - while (1) { + for (;;) { int option; option = getopt_long(argc, argv, "dDthV", options, NULL);