summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-03-27 09:11:25 +0000
committerJim Meyering <jim@meyering.net>2004-03-27 09:11:25 +0000
commite95d9e93d99ce16d1a97826ddd51b4f1c0349a9f (patch)
tree42b855e81fe0824818470dc42027326f095b4393
parent960c069c1ba5b2050104781ac5ecc707ff17d0e1 (diff)
downloadcoreutils-e95d9e93d99ce16d1a97826ddd51b4f1c0349a9f.tar.xz
(main): Rearrange filtering loop to be a tiny bit more efficient.
-rw-r--r--src/du.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/du.c b/src/du.c
index b9f38864f..7ecaede1a 100644
--- a/src/du.c
+++ b/src/du.c
@@ -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);
}