diff options
author | Jim Meyering <jim@meyering.net> | 2004-03-27 09:11:25 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2004-03-27 09:11:25 +0000 |
commit | e95d9e93d99ce16d1a97826ddd51b4f1c0349a9f (patch) | |
tree | 42b855e81fe0824818470dc42027326f095b4393 | |
parent | 960c069c1ba5b2050104781ac5ecc707ff17d0e1 (diff) | |
download | coreutils-e95d9e93d99ce16d1a97826ddd51b4f1c0349a9f.tar.xz |
(main): Rearrange filtering loop to be a tiny bit more efficient.
-rw-r--r-- | src/du.c | 42 |
1 files changed, 25 insertions, 17 deletions
@@ -773,23 +773,31 @@ main (int argc, char **argv) size_t i = 0; size_t j; - for (j = 0; (files[i] = files[j]); j++) - if (files[i][0]) - i++; - else - { - if (files_from) - { - /* Using the standard `filename:line-number:' prefix here is - not totally appropriate, since NUL is the separator, not NL, - but it might be better than nothing. */ - unsigned long int file_number = j + 1; - error (0, 0, "%s:%lu: %s", quotearg_colon (files_from), - file_number, _("invalid zero-length file name")); - } - else - error (0, 0, "%s", _("invalid zero-length file name")); - } + for (j = 0; ; j++) + { + if (i != j) + files[i] = files[j]; + + if ( ! files[i]) + break; + + if (files[i][0]) + i++; + else + { + if (files_from) + { + /* Using the standard `filename:line-number:' prefix here is + not totally appropriate, since NUL is the separator, not NL, + but it might be better than nothing. */ + unsigned long int file_number = j + 1; + error (0, 0, "%s:%lu: %s", quotearg_colon (files_from), + file_number, _("invalid zero-length file name")); + } + else + error (0, 0, "%s", _("invalid zero-length file name")); + } + } fail = (i != j); } |