mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-20 10:51:48 +02:00
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.
This commit is contained in:
10
src/head.c
10
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. */
|
||||
|
||||
@@ -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)
|
||||
|
||||
4
src/wc.c
4
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. */
|
||||
|
||||
Reference in New Issue
Block a user