*: hopefully all setup_common_bufsiz() are in place

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2016-04-21 18:38:51 +02:00
parent 47cfbf32fd
commit 9de2e5a222
29 changed files with 83 additions and 55 deletions

View File

@@ -109,16 +109,15 @@ struct globals {
#define proc_meminfo (G.proc_meminfo )
#define proc_diskstats (G.proc_diskstats )
#define proc_sys_fs_filenr (G.proc_sys_fs_filenr)
#define outbuf bb_common_bufsiz1
#define INIT_G() do { \
setup_common_bufsiz(); \
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
cur_outbuf = outbuf; \
G.final_char = '\n'; \
G.deltanz = G.delta = 1000000; \
} while (0)
#define outbuf bb_common_bufsiz1
#define sizeof_outbuf COMMON_BUFSIZE
static inline void reset_outbuf(void)
{
cur_outbuf = outbuf;
@@ -141,7 +140,7 @@ static void print_outbuf(void)
static void put(const char *s)
{
char *p = cur_outbuf;
int sz = outbuf + sizeof_outbuf - p;
int sz = outbuf + COMMON_BUFSIZE - p;
while (*s && --sz >= 0)
*p++ = *s++;
cur_outbuf = p;
@@ -149,7 +148,7 @@ static void put(const char *s)
static void put_c(char c)
{
if (cur_outbuf < outbuf + sizeof_outbuf)
if (cur_outbuf < outbuf + COMMON_BUFSIZE)
*cur_outbuf++ = c;
}