]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tail: use size_t for counter and index variables, ...
authorJim Meyering <meyering@redhat.com>
Wed, 8 Jul 2009 17:49:46 +0000 (19:49 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 8 Jul 2009 17:53:43 +0000 (19:53 +0200)
* src/tail.c (any_live_files): ... not "int" or even unsigned int
(tail_forever, tail_forever_inotify, main): Likewise.

src/tail.c

index 79c5576360af948da218e5cdaf04e175dcbedfce..2ac62b229861d15e4380827e0cf47b77269a662f 100644 (file)
@@ -978,9 +978,9 @@ recheck (struct File_spec *f, bool blocking)
    open file descriptors.  */
 
 static bool
-any_live_files (const struct File_spec *f, int n_files)
+any_live_files (const struct File_spec *f, size_t n_files)
 {
-  int i;
+  size_t i;
 
   for (i = 0; i < n_files; i++)
     if (0 <= f[i].fd)
@@ -996,19 +996,19 @@ any_live_files (const struct File_spec *f, int n_files)
    while and try again.  Continue until the user interrupts us.  */
 
 static void
-tail_forever (struct File_spec *f, int n_files, double sleep_interval)
+tail_forever (struct File_spec *f, size_t n_files, double sleep_interval)
 {
   /* Use blocking I/O as an optimization, when it's easy.  */
   bool blocking = (pid == 0 && follow_mode == Follow_descriptor
                   && n_files == 1 && ! S_ISREG (f[0].mode));
-  int last;
+  size_t last;
   bool writer_is_dead = false;
 
   last = n_files - 1;
 
   while (1)
     {
-      int i;
+      size_t i;
       bool any_input = false;
 
       for (i = 0; i < n_files; i++)
@@ -1162,9 +1162,9 @@ wd_comparator (const void *e1, const void *e2)
    Check modifications using the inotify events system.  */
 
 static void
-tail_forever_inotify (int wd, struct File_spec *f, int n_files)
+tail_forever_inotify (int wd, struct File_spec *f, size_t n_files)
 {
-  unsigned int i;
+  size_t i;
   unsigned int max_realloc = 3;
   Hash_table *wd_table;
 
@@ -1833,10 +1833,10 @@ main (int argc, char **argv)
      the number of items at the end of the file to print.  Although the type
      is signed, the value is never negative.  */
   uintmax_t n_units = DEFAULT_N_LINES;
-  int n_files;
+  size_t n_files;
   char **file;
   struct File_spec *F;
-  int i;
+  size_t i;
   bool obsolete_option;
 
   /* The number of seconds to sleep between iterations.