From d0a9750e08a4cf0329f99a9956ab85f196a81263 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 28 May 2011 13:52:13 +0200 Subject: maint: remove useless (off_t) cast of lseek arg * src/wc.c (wc): Remove unnecessary cast. * src/head.c (elide_tail_bytes_file, elide_tail_lines_file): Likewise. * src/tac.c (tac_seekable, tac_file): Likewise. --- src/head.c | 10 +++++----- src/tac.c | 4 ++-- src/wc.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/head.c b/src/head.c index b3ac7fdf8..84f9582e0 100644 --- a/src/head.c +++ b/src/head.c @@ -422,8 +422,8 @@ elide_tail_bytes_file (const char *filename, int fd, uintmax_t n_elide) off_t diff; enum Copy_fd_status err; - if ((current_pos = lseek (fd, (off_t) 0, SEEK_CUR)) == -1 - || (end_pos = lseek (fd, (off_t) 0, SEEK_END)) == -1) + if ((current_pos = lseek (fd, 0, SEEK_CUR)) == -1 + || (end_pos = lseek (fd, 0, SEEK_END)) == -1) { error (0, errno, _("cannot lseek %s"), quote (filename)); return false; @@ -438,7 +438,7 @@ elide_tail_bytes_file (const char *filename, int fd, uintmax_t n_elide) /* Seek back to `current' position, then copy the required number of bytes from fd. */ - if (lseek (fd, (off_t) 0, current_pos) == -1) + if (lseek (fd, 0, current_pos) == -1) { error (0, errno, _("%s: cannot lseek back to original position"), quote (filename)); @@ -716,8 +716,8 @@ elide_tail_lines_file (const char *filename, int fd, uintmax_t n_elide) If found, write from current position to OFF, inclusive. Otherwise, just return true. */ - off_t start_pos = lseek (fd, (off_t) 0, SEEK_CUR); - off_t end_pos = lseek (fd, (off_t) 0, SEEK_END); + off_t start_pos = lseek (fd, 0, SEEK_CUR); + off_t end_pos = lseek (fd, 0, SEEK_END); if (0 <= start_pos && start_pos < end_pos) { /* If the file is empty, we're done. */ diff --git a/src/tac.c b/src/tac.c index 2e110fac5..65ac6a6fc 100644 --- a/src/tac.c +++ b/src/tac.c @@ -215,7 +215,7 @@ tac_seekable (int input_fd, const char *file) size_t match_length1 = match_length - 1; /* Speed optimization, non-regexp. */ /* Find the size of the input file. */ - file_pos = lseek (input_fd, (off_t) 0, SEEK_END); + file_pos = lseek (input_fd, 0, SEEK_END); if (file_pos < 1) return true; /* It's an empty file. */ @@ -546,7 +546,7 @@ tac_file (const char *filename) } } - file_size = lseek (fd, (off_t) 0, SEEK_END); + file_size = lseek (fd, 0, SEEK_END); ok = (file_size < 0 || isatty (fd) ? tac_nonseekable (fd, filename) diff --git a/src/wc.c b/src/wc.c index 702a7a779..d5a0afc23 100644 --- a/src/wc.c +++ b/src/wc.c @@ -234,8 +234,8 @@ wc (int fd, char const *file_x, struct fstatus *fstatus) fstatus->failed = fstat (fd, &fstatus->st); if (! fstatus->failed && S_ISREG (fstatus->st.st_mode) - && (current_pos = lseek (fd, (off_t) 0, SEEK_CUR)) != -1 - && (end_pos = lseek (fd, (off_t) 0, SEEK_END)) != -1) + && (current_pos = lseek (fd, 0, SEEK_CUR)) != -1 + && (end_pos = lseek (fd, 0, SEEK_END)) != -1) { /* Be careful here. The current position may actually be beyond the end of the file. As in the example above. */ -- cgit v1.2.3-54-g00ecf