summaryrefslogtreecommitdiff
path: root/src/split.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-04-09 14:40:05 +0000
committerJim Meyering <jim@meyering.net>2003-04-09 14:40:05 +0000
commit78d8a32a1af7686d1a035f81181f632b5b7defae (patch)
tree751eded23b338699a7f59a6e65eae64f0fd4d0c1 /src/split.c
parenta69132e7172d142ac7baa6b9e0e99e1e4c27cfe2 (diff)
downloadcoreutils-78d8a32a1af7686d1a035f81181f632b5b7defae.tar.xz
(bytes_split): Use size_t temporary (rather than
uintmax_t original) in remaining computations. From Paul Eggert.
Diffstat (limited to 'src/split.c')
-rw-r--r--src/split.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/split.c b/src/split.c
index 3fc346c1b..261fd23ce 100644
--- a/src/split.c
+++ b/src/split.c
@@ -218,7 +218,6 @@ bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize)
to_read = n_read;
for (;;)
{
- size_t last_bufsize;
if (to_read < to_write)
{
if (to_read) /* do not write 0 bytes! */
@@ -229,13 +228,15 @@ bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize)
}
break;
}
-
- last_bufsize = to_write;
- cwrite (new_file_flag, bp_out, last_bufsize);
- bp_out += to_write;
- to_read -= to_write;
- new_file_flag = 1;
- to_write = n_bytes;
+ else
+ {
+ size_t w = to_write;
+ cwrite (new_file_flag, bp_out, w);
+ bp_out += w;
+ to_read -= w;
+ new_file_flag = 1;
+ to_write = n_bytes;
+ }
}
}
while (n_read == bufsize);