aboutsummaryrefslogtreecommitdiff
path: root/procps/nmeter.c
diff options
context:
space:
mode:
Diffstat (limited to 'procps/nmeter.c')
-rw-r--r--procps/nmeter.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/procps/nmeter.c b/procps/nmeter.c
index 33de3790f..3eac2d3b2 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -53,6 +53,7 @@
53// totalswap=134209536, freeswap=134209536, procs=157}) 53// totalswap=134209536, freeswap=134209536, procs=157})
54 54
55#include "libbb.h" 55#include "libbb.h"
56#include "common_bufsiz.h"
56 57
57typedef unsigned long long ullong; 58typedef unsigned long long ullong;
58 59
@@ -108,16 +109,15 @@ struct globals {
108#define proc_meminfo (G.proc_meminfo ) 109#define proc_meminfo (G.proc_meminfo )
109#define proc_diskstats (G.proc_diskstats ) 110#define proc_diskstats (G.proc_diskstats )
110#define proc_sys_fs_filenr (G.proc_sys_fs_filenr) 111#define proc_sys_fs_filenr (G.proc_sys_fs_filenr)
112#define outbuf bb_common_bufsiz1
111#define INIT_G() do { \ 113#define INIT_G() do { \
114 setup_common_bufsiz(); \
112 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ 115 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
113 cur_outbuf = outbuf; \ 116 cur_outbuf = outbuf; \
114 G.final_char = '\n'; \ 117 G.final_char = '\n'; \
115 G.deltanz = G.delta = 1000000; \ 118 G.deltanz = G.delta = 1000000; \
116} while (0) 119} while (0)
117 120
118// We depend on this being a char[], not char* - we take sizeof() of it
119#define outbuf bb_common_bufsiz1
120
121static inline void reset_outbuf(void) 121static inline void reset_outbuf(void)
122{ 122{
123 cur_outbuf = outbuf; 123 cur_outbuf = outbuf;
@@ -140,7 +140,7 @@ static void print_outbuf(void)
140static void put(const char *s) 140static void put(const char *s)
141{ 141{
142 char *p = cur_outbuf; 142 char *p = cur_outbuf;
143 int sz = outbuf + sizeof(outbuf) - p; 143 int sz = outbuf + COMMON_BUFSIZE - p;
144 while (*s && --sz >= 0) 144 while (*s && --sz >= 0)
145 *p++ = *s++; 145 *p++ = *s++;
146 cur_outbuf = p; 146 cur_outbuf = p;
@@ -148,7 +148,7 @@ static void put(const char *s)
148 148
149static void put_c(char c) 149static void put_c(char c)
150{ 150{
151 if (cur_outbuf < outbuf + sizeof(outbuf)) 151 if (cur_outbuf < outbuf + COMMON_BUFSIZE)
152 *cur_outbuf++ = c; 152 *cur_outbuf++ = c;
153} 153}
154 154