diff options
author | Jim Meyering <meyering@redhat.com> | 2010-05-01 14:24:35 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-05-31 11:02:21 +0200 |
commit | da7a704cd36e1d2015d14247e5139fb1999b2211 (patch) | |
tree | 8302e47cb2f6fdef10059934e06413506ba1111d /gl/lib | |
parent | 5591f19e9cbee3598d23ea728fdebb396e2df89a (diff) | |
download | coreutils-da7a704cd36e1d2015d14247e5139fb1999b2211.tar.xz |
maint: replace each "for (;;)" with "while (true)"
Run this command:
git ls-files | grep '\.[ch]$' \
| xargs perl -pi -e 's/for \(;;\)/while (true)/g'
...except for randint.c, which does not include stdbool.h.
In that case, use "while (1)".
* gl/lib/randint.c (randint_genmax): Use "while (1)" for infloops.
* src/cat.c (simple_cat, cat): Use "while (true)" for infloops.
* gl/lib/randread.c (readsource, readisaac): Likewise.
* src/copy.c (copy_reg): Likewise.
* src/csplit.c (record_line_starts, process_regexp): Likewise.
* src/cut.c (set_fields): Likewise.
* src/dd.c (iread, parse_symbols): Likewise.
* src/df.c (find_mount_point, main): Likewise.
* src/du.c (main): Likewise.
* src/expand.c (expand): Likewise.
* src/factor.c (factor_using_division, do_stdin): Likewise.
* src/fmt.c (get_space): Likewise.
* src/ls.c (decode_switches): Likewise.
* src/od.c (main): Likewise.
* src/pr.c (main, read_line): Likewise.
* src/shred.c (dopass, genpattern): Likewise.
* src/sort.c (initbuf, fillbuf, getmonth, keycompare): Likewise.
* src/split.c (bytes_split, lines_split): Likewise.
* src/tac.c (tac_seekable): Likewise.
* src/test.c (and, or): Likewise.
* src/tr.c (squeeze_filter, main): Likewise.
* src/tsort.c (search_item): Likewise.
* src/unexpand.c (unexpand): Likewise.
* src/uniq.c (main): Likewise.
* src/yes.c (main): Likewise.
Diffstat (limited to 'gl/lib')
-rw-r--r-- | gl/lib/randint.c | 2 | ||||
-rw-r--r-- | gl/lib/randread.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/gl/lib/randint.c b/gl/lib/randint.c index cb39221b4..f3de3fc9a 100644 --- a/gl/lib/randint.c +++ b/gl/lib/randint.c @@ -125,7 +125,7 @@ randint_genmax (struct randint_source *s, randint genmax) randint randmax = s->randmax; randint choices = genmax + 1; - for (;;) + while (1) { if (randmax < genmax) { diff --git a/gl/lib/randread.c b/gl/lib/randread.c index 65e9d6369..94b9928b2 100644 --- a/gl/lib/randread.c +++ b/gl/lib/randread.c @@ -199,7 +199,7 @@ randread_set_handler_arg (struct randread_source *s, void const *handler_arg) static void readsource (struct randread_source *s, unsigned char *p, size_t size) { - for (;;) + while (true) { size_t inbytes = fread (p, sizeof *p, size, s->source); int fread_errno = errno; @@ -221,7 +221,7 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size) { size_t inbytes = isaac->buffered; - for (;;) + while (true) { if (size <= inbytes) { |