(main): Rearrange filtering loop to be a tiny bit more efficient.
authorJim Meyering <jim@meyering.net>
Sat, 27 Mar 2004 09:11:25 +0000 (09:11 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 27 Mar 2004 09:11:25 +0000 (09:11 +0000)
src/du.c

index b9f38864feb3012ae472c44cdd7c0acf33cba528..7ecaede1a6e9253578d1fc7afdc226f75a608f89 100644 (file)
--- 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);
   }