From a965ed1b138797868a380d406cad6f7909653165 Mon Sep 17 00:00:00 2001 From: merlokk Date: Mon, 29 Jan 2018 19:38:52 +0200 Subject: [PATCH] added several buffers to printBitsPar --- client/util.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/util.c b/client/util.c index 07a53196..bbc7f2cf 100644 --- a/client/util.c +++ b/client/util.c @@ -357,8 +357,14 @@ char * printBits(size_t const size, void const * const ptr) } char * printBitsPar(const uint8_t *b, size_t len) { - static char buf[1024] = {0}; - memset(buf, 0x00, 1024); + static char buf1[512] = {0}; + static char buf2[512] = {0}; + static char *buf; + if (buf != buf1) + buf = buf1; + else + buf = buf2; + memset(buf, 0x00, 512); for (int i = 0; i < len; i++) { buf[i] = ((b[i / 8] << (i % 8)) & 0x80) ? '1':'0';