summaryrefslogtreecommitdiff
path: root/lib/vsnprintf.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-04-01 01:09:35 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-04-01 01:09:35 +0400
commit5d269789a54d43e4d210438fd32b01fa743100e0 (patch)
tree61d22f843430e6aa42436efea9866edcf3eca509 /lib/vsnprintf.c
parent1f6a046d8545d232f6dce2493da63e7f0d69e496 (diff)
downloadnasm-5d269789a54d43e4d210438fd32b01fa743100e0.tar.gz
vsnprintf: Style nitfix
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'lib/vsnprintf.c')
-rw-r--r--lib/vsnprintf.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/vsnprintf.c b/lib/vsnprintf.c
index f5ae2feb..16d449cf 100644
--- a/lib/vsnprintf.c
+++ b/lib/vsnprintf.c
@@ -14,7 +14,7 @@
#include "nasmlib.h"
-#define BUFFER_SIZE 65536 /* Bigger than any string we might print... */
+#define BUFFER_SIZE 65536 /* Bigger than any string we might print... */
static char snprintf_buffer[BUFFER_SIZE];
@@ -23,26 +23,25 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap)
int rv, bytes;
if (size > BUFFER_SIZE) {
- nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
- "snprintf: size (%d) > BUFFER_SIZE (%d)",
- size, BUFFER_SIZE);
- size = BUFFER_SIZE;
+ nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
+ "snprintf: size (%d) > BUFFER_SIZE (%d)",
+ size, BUFFER_SIZE);
+ size = BUFFER_SIZE;
}
rv = vsprintf(snprintf_buffer, format, ap);
if (rv >= BUFFER_SIZE) {
- nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
- "snprintf buffer overflow");
+ nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
+ "snprintf buffer overflow");
}
if (size > 0) {
- if ((size_t)rv < size-1)
- bytes = rv;
- else
- bytes = size-1;
-
- memcpy(str, snprintf_buffer, bytes);
- str[bytes] = '\0';
+ if ((size_t)rv < size-1)
+ bytes = rv;
+ else
+ bytes = size-1;
+ memcpy(str, snprintf_buffer, bytes);
+ str[bytes] = '\0';
}
return rv;