aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
author"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-10-15 10:23:55 +0000
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-10-15 10:23:55 +0000
commit6f347ef9dc540aaea025c0575e586817cd85cc8e (patch)
tree5fc98f67e92bb2eca75d33940a4f8698bb216f3a /coreutils
parent84e7511607600c2c7b9e7c4087897d44cc4668c4 (diff)
downloadbusybox-6f347ef9dc540aaea025c0575e586817cd85cc8e.tar.gz
common BUFSIZ BSS buffer, small reduce code, data and bss
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/dos2unix.c3
-rw-r--r--coreutils/tee.c6
-rw-r--r--coreutils/tr.c9
3 files changed, 7 insertions, 11 deletions
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c
index 0c419aca7..0464df76f 100644
--- a/coreutils/dos2unix.c
+++ b/coreutils/dos2unix.c
@@ -44,12 +44,13 @@
* to pick a random letter to add to out temporary file. */
typedef unsigned long int bb_uint64_t;
+#define tempFn bb_common_bufsiz1
+
/* if fn is NULL then input is stdin and output is stdout */
static int convert(char *fn, int ConvType)
{
int c, fd;
struct timeval tv;
- RESERVE_CONFIG_BUFFER(tempFn, BUFSIZ);
static bb_uint64_t value=0;
FILE *in, *out;
diff --git a/coreutils/tee.c b/coreutils/tee.c
index ba2e10f90..1160fc9dd 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -39,7 +39,7 @@ int tee_main(int argc, char **argv)
int retval = EXIT_SUCCESS;
#ifdef CONFIG_FEATURE_TEE_USE_BLOCK_IO
ssize_t c;
- RESERVE_CONFIG_BUFFER(buf, BUFSIZ);
+# define buf bb_common_bufsiz1
#else
int c;
#endif
@@ -88,10 +88,6 @@ int tee_main(int argc, char **argv)
retval = EXIT_FAILURE;
}
-#ifdef CONFIG_FEATURE_CLEAN_UP
- RELEASE_CONFIG_BUFFER(buf);
-#endif
-
#else
setvbuf(stdout, NULL, _IONBF, 0);
while ((c = getchar()) != EOF) {
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 6e3f97b36..e9eca4c60 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -38,10 +38,11 @@
static char com_fl, del_fl, sq_fl;
static short in_index, out_index;
/* these last are pointers to static buffers declared in tr_main */
-static unsigned char *poutput, *pinput;
+static unsigned char *poutput;
static unsigned char *pvector;
static char *pinvec, *poutvec;
+#define input bb_common_bufsiz1
static void convert(void)
{
@@ -51,14 +52,14 @@ static void convert(void)
for (;;) {
if (in_index == read_chars) {
- if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
+ if ((read_chars = read(0, input, BUFSIZ)) <= 0) {
if (write(1, (char *) poutput, out_index) != out_index)
bb_error_msg(bb_msg_write_error);
exit(0);
}
in_index = 0;
}
- c = pinput[in_index++];
+ c = input[in_index++];
coded = pvector[c];
if (del_fl && pinvec[c])
continue;
@@ -208,14 +209,12 @@ extern int tr_main(int argc, char **argv)
int idx = 1;
int i;
RESERVE_CONFIG_BUFFER(output, BUFSIZ);
- RESERVE_CONFIG_BUFFER(input, BUFSIZ);
RESERVE_CONFIG_UBUFFER(vector, ASCII+1);
RESERVE_CONFIG_BUFFER(invec, ASCII+1);
RESERVE_CONFIG_BUFFER(outvec, ASCII+1);
/* ... but make them available globally */
poutput = output;
- pinput = input;
pvector = vector;
pinvec = invec;
poutvec = outvec;