Audit bb_common_bufsiz usage, add script which looks for misuse.
tr: stop using globals needlessly.
code: -103 bytes
diff --git a/archival/tar.c b/archival/tar.c
index 4323553..adcedf6 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -28,6 +28,8 @@
#include "libbb.h"
#include "unarchive.h"
+#define block_buf bb_common_bufsiz1
+
#if ENABLE_FEATURE_TAR_CREATE
/* Tar file constants */
@@ -475,8 +477,8 @@
/* Pad the file up to the tar block size */
/* (a few tricks here in the name of code size) */
readSize = (-(int)statbuf->st_size) & (TAR_BLOCK_SIZE-1);
- memset(bb_common_bufsiz1, 0, readSize);
- xwrite(tbInfo->tarFd, bb_common_bufsiz1, readSize);
+ memset(block_buf, 0, readSize);
+ xwrite(tbInfo->tarFd, block_buf, readSize);
}
return TRUE;
@@ -570,8 +572,8 @@
include = include->link;
}
/* Write two empty blocks to the end of the archive */
- memset(bb_common_bufsiz1, 0, 2*TAR_BLOCK_SIZE);
- xwrite(tbInfo.tarFd, bb_common_bufsiz1, 2*TAR_BLOCK_SIZE);
+ memset(block_buf, 0, 2*TAR_BLOCK_SIZE);
+ xwrite(tbInfo.tarFd, block_buf, 2*TAR_BLOCK_SIZE);
/* To be pedantically correct, we would check if the tarball
* is smaller than 20 tar blocks, and pad it if it was smaller,