]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: remove useless (off_t) cast of lseek arg
authorJim Meyering <meyering@redhat.com>
Sat, 28 May 2011 11:52:13 +0000 (13:52 +0200)
committerJim Meyering <meyering@redhat.com>
Sat, 28 May 2011 11:52:17 +0000 (13:52 +0200)
* 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
src/tac.c
src/wc.c

index b3ac7fdf85b3604356c7176eb01a13a7039f0d78..84f9582e0ed7fd8f4a138acf63daccea616a4a16 100644 (file)
@@ -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.  */
index 2e110fac55e4c37e92870072a052fdaf6f6f36bf..65ac6a6fc869d7dc09428974cd0cb52fc0349a0a 100644 (file)
--- 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)
index 702a7a779c7bc99579500447a7be537c044dd2c3..d5a0afc23d6a84cfc31215898c43e482f8029eb7 100644 (file)
--- 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.  */