]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: replace while(1) by for(;;) everywhere 1216/head
authorLennart Poettering <lennart@poettering.net>
Wed, 9 Sep 2015 12:33:32 +0000 (14:33 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 9 Sep 2015 12:59:53 +0000 (14:59 +0200)
Another Coccinelle script.

coccinelle/while-true.cocci [new file with mode: 0644]
src/bootchart/svg.c
src/journal-remote/journal-remote-parse.c
src/journal-remote/journal-remote.c
src/journal-remote/journal-upload-journal.c
src/journal-remote/journal-upload.c
src/udev/ata_id/ata_id.c
src/udev/cdrom_id/cdrom_id.c
src/udev/collect/collect.c
src/udev/scsi_id/scsi_id.c

diff --git a/coccinelle/while-true.cocci b/coccinelle/while-true.cocci
new file mode 100644 (file)
index 0000000..c23fb11
--- /dev/null
@@ -0,0 +1,12 @@
+@@
+statement s;
+@@
+- while (true)
++ for (;;)
+s
+@@
+statement s;
+@@
+- while (1)
++ for (;;)
+s
index 1231e6eaceb075847de150b959310133b8b135b6..c66f12e3a6fcb2c7aa00e250c5e74ffacdd09b26 100644 (file)
@@ -888,7 +888,7 @@ static struct ps_struct *get_next_ps(struct ps_struct *ps, struct ps_struct *ps_
                 return ps->next;
 
         /* go back for parent siblings */
-        while (1) {
+        for (;;) {
                 if (ps->parent && ps->parent->next)
                         return ps->parent->next;
 
index 5ff05d3ad6182661f95c21b3a297af9eff00d5cf..2e0f78701a5a9a1214b4f4e681d0ded6ffa001a1 100644 (file)
@@ -94,7 +94,7 @@ static int get_line(RemoteSource *source, char **line, size_t *size) {
         assert(source->buf == NULL || source->size > 0);
         assert(source->fd >= 0);
 
-        while (true) {
+        for (;;) {
                 if (source->buf) {
                         size_t start = MAX(source->scanned, source->offset);
 
index efa4baafdee6fb0b1ed3e3152d418669318cb668..d6ebca20ec56fb25cf69aecc5daede1174f9b052 100644 (file)
@@ -518,7 +518,7 @@ static int process_http_upload(
         } else
                 finished = true;
 
-        while (true) {
+        for (;;) {
                 r = process_source(source, arg_compress, arg_seal);
                 if (r == -EAGAIN)
                         break;
index 507210f51c4c57c071fca7c34eff46f747226d36..6b3ad924a736126b51b6580a6941fe1554fab1a2 100644 (file)
@@ -17,7 +17,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
 
         assert(size <= SSIZE_MAX);
 
-        while (true) {
+        for (;;) {
 
                 switch(u->entry_state) {
                 case ENTRY_CURSOR: {
index 172fd80a12ad17680c125e353c6d7d1c7c0b64ae..311bd3fddab7368fb4f9046dba9e48899cdd671a 100644 (file)
@@ -828,7 +828,7 @@ int main(int argc, char **argv) {
                   "READY=1\n"
                   "STATUS=Processing input...");
 
-        while (true) {
+        for (;;) {
                 r = sd_event_get_state(u.events);
                 if (r < 0)
                         break;
index c6a2c56e77313258cf074316d12c0d80a40a514a..e265aa5f53898894417f6702d33dc1289e28b48e 100644 (file)
@@ -432,7 +432,7 @@ int main(int argc, char *argv[])
         if (udev == NULL)
                 return 0;
 
-        while (1) {
+        for (;;) {
                 int option;
 
                 option = getopt_long(argc, argv, "xh", options, NULL);
index e6a9e354ff308942b381a3ee7ccd08b0b82de5ad..001bae7a245ddcda497b48045774a97f164f3fce 100644 (file)
@@ -868,7 +868,7 @@ int main(int argc, char *argv[])
         if (udev == NULL)
                 goto exit;
 
-        while (1) {
+        for (;;) {
                 int option;
 
                 option = getopt_long(argc, argv, "deluh", options, NULL);
index 6cf41c67bb322f6adef1ddb2190b52340fd6e99f..b3a1f0bca1f987ff934ea8a3b17b5c6ae8a493b3 100644 (file)
@@ -364,7 +364,7 @@ int main(int argc, char **argv)
                 goto exit;
         }
 
-        while (1) {
+        for (;;) {
                 int option;
 
                 option = getopt_long(argc, argv, "ardh", options, NULL);
index 3c4653fd19ad56082532400b5866bfb3de466bb1..adb91869df0be7403daad3f5eb4d1ebcfad8391a 100644 (file)
@@ -190,7 +190,7 @@ static int get_file_options(struct udev *udev,
 
         *newargv = NULL;
         lineno = 0;
-        while (1) {
+        for (;;) {
                 vendor_in = model_in = options_in = NULL;
 
                 buf = fgets(buffer, MAX_BUFFER_LEN, f);