FYI, I've just pushed these two. Snapshot coming soon. >From 3639a880aa9778bd6f30be4e953ad9b1171110a1 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Wed, 8 Jul 2009 19:51:22 +0200 Subject: [PATCH 1/2] tail: declare "file descriptor" variable to be "int", not size_t
* src/tail.c (tail_forever_inotify): Use "int", not size_t as the type of a file descriptor variable. --- src/tail.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/tail.c b/src/tail.c index b3ebba9..79c5576 100644 --- a/src/tail.c +++ b/src/tail.c @@ -1169,7 +1169,7 @@ tail_forever_inotify (int wd, struct File_spec *f, int n_files) Hash_table *wd_table; bool found_watchable = false; - size_t prev_wd; + int prev_wd; size_t evlen = 0; char *evbuf; size_t evbuf_off = 0; -- 1.6.3.3.524.g8586b >From 0e931753015889598af771b5399ea6fa4c4f9619 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Wed, 8 Jul 2009 19:49:46 +0200 Subject: [PATCH 2/2] tail: use size_t for counter and index variables, ... * src/tail.c (any_live_files): ... not "int" or even unsigned int (tail_forever, tail_forever_inotify, main): Likewise. --- src/tail.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/tail.c b/src/tail.c index 79c5576..2ac62b2 100644 --- a/src/tail.c +++ b/src/tail.c @@ -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. -- 1.6.3.3.524.g8586b _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
