summaryrefslogtreecommitdiff
path: root/coreutils/cksum.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-06-04 10:16:52 +0000
committerDenis Vlasenko2007-06-04 10:16:52 +0000
commit74324c86663f57a19c1de303ee8c8e5449db9ef2 (patch)
tree11f5da9de4212875ce5811be2e1050e076378c9a /coreutils/cksum.c
parent4e5f82c76f08614d0b69f9ec4a8baac303af15f6 (diff)
downloadbusybox-74324c86663f57a19c1de303ee8c8e5449db9ef2.zip
busybox-74324c86663f57a19c1de303ee8c8e5449db9ef2.tar.gz
Audit bb_common_bufsiz usage, add script which looks for misuse.
tr: stop using globals needlessly. code: -103 bytes
Diffstat (limited to 'coreutils/cksum.c')
-rw-r--r--coreutils/cksum.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index 865bea0..987f5f3 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -27,8 +27,9 @@ int cksum_main(int argc, char **argv)
crc = 0;
length = 0;
- while ((bytes_read = fread(bb_common_bufsiz1, 1, BUFSIZ, fp)) > 0) {
- cp = bb_common_bufsiz1;
+#define read_buf bb_common_bufsiz1
+ while ((bytes_read = fread(read_buf, 1, BUFSIZ, fp)) > 0) {
+ cp = read_buf;
length += bytes_read;
while (bytes_read--)
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ (*cp++)) & 0xffL];