aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-04-21 18:38:51 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-04-21 18:38:51 +0200
commit9de2e5a22213842da5b116723392de88de9ed419 (patch)
treedff999a566382174e084d377dc3b4c03de1d4c62 /procps
parent47cfbf32fd66563f8c4e09ad6cced6abfbe2fad5 (diff)
downloadbusybox-w32-9de2e5a22213842da5b116723392de88de9ed419.tar.gz
busybox-w32-9de2e5a22213842da5b116723392de88de9ed419.tar.bz2
busybox-w32-9de2e5a22213842da5b116723392de88de9ed419.zip
*: hopefully all setup_common_bufsiz() are in place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r--procps/nmeter.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/procps/nmeter.c b/procps/nmeter.c
index efa3d553d..3eac2d3b2 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -109,16 +109,15 @@ struct globals {
109#define proc_meminfo (G.proc_meminfo ) 109#define proc_meminfo (G.proc_meminfo )
110#define proc_diskstats (G.proc_diskstats ) 110#define proc_diskstats (G.proc_diskstats )
111#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
112#define INIT_G() do { \ 113#define INIT_G() do { \
114 setup_common_bufsiz(); \
113 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ 115 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
114 cur_outbuf = outbuf; \ 116 cur_outbuf = outbuf; \
115 G.final_char = '\n'; \ 117 G.final_char = '\n'; \
116 G.deltanz = G.delta = 1000000; \ 118 G.deltanz = G.delta = 1000000; \
117} while (0) 119} while (0)
118 120
119#define outbuf bb_common_bufsiz1
120#define sizeof_outbuf COMMON_BUFSIZE
121
122static inline void reset_outbuf(void) 121static inline void reset_outbuf(void)
123{ 122{
124 cur_outbuf = outbuf; 123 cur_outbuf = outbuf;
@@ -141,7 +140,7 @@ static void print_outbuf(void)
141static void put(const char *s) 140static void put(const char *s)
142{ 141{
143 char *p = cur_outbuf; 142 char *p = cur_outbuf;
144 int sz = outbuf + sizeof_outbuf - p; 143 int sz = outbuf + COMMON_BUFSIZE - p;
145 while (*s && --sz >= 0) 144 while (*s && --sz >= 0)
146 *p++ = *s++; 145 *p++ = *s++;
147 cur_outbuf = p; 146 cur_outbuf = p;
@@ -149,7 +148,7 @@ static void put(const char *s)
149 148
150static void put_c(char c) 149static void put_c(char c)
151{ 150{
152 if (cur_outbuf < outbuf + sizeof_outbuf) 151 if (cur_outbuf < outbuf + COMMON_BUFSIZE)
153 *cur_outbuf++ = c; 152 *cur_outbuf++ = c;
154} 153}
155 154