From 9ae4975fc049de433ad8e2399c391d207208233a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 16 Jun 2015 13:18:31 -0700 Subject: astyle formatting changes. --- src/buffer.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 7d16af8..e07fba6 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -29,18 +29,20 @@ void cmark_strbuf_init(cmark_strbuf *buf, bufsize_t initial_size) cmark_strbuf_grow(buf, initial_size); } -void cmark_strbuf_overflow_err() { +void cmark_strbuf_overflow_err() +{ fprintf(stderr, "String buffer overflow"); abort(); } static inline void -S_strbuf_grow_by(cmark_strbuf *buf, size_t add) { +S_strbuf_grow_by(cmark_strbuf *buf, size_t add) +{ size_t target_size = (size_t)buf->size + add; if (target_size < add /* Integer overflow. */ || target_size > BUFSIZE_MAX /* Truncation overflow. */ - ) { + ) { cmark_strbuf_overflow_err(); return; /* unreachable */ } @@ -74,7 +76,7 @@ void cmark_strbuf_grow(cmark_strbuf *buf, bufsize_t target_size) if (new_size < (size_t)target_size /* Integer overflow. */ || new_size > BUFSIZE_MAX /* Truncation overflow. */ - ) { + ) { if (target_size >= BUFSIZE_MAX) { /* No space for terminating null byte. */ cmark_strbuf_overflow_err(); @@ -160,7 +162,7 @@ void cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, bufsize_t le void cmark_strbuf_puts(cmark_strbuf *buf, const char *string) { cmark_strbuf_put(buf, (const unsigned char *)string, - cmark_strbuf_safe_strlen(string)); + cmark_strbuf_safe_strlen(string)); } void cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap) @@ -175,10 +177,10 @@ void cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap) va_copy(args, ap); int len = vsnprintf( - (char *)buf->ptr + buf->size, - buf->asize - buf->size, - format, args - ); + (char *)buf->ptr + buf->size, + buf->asize - buf->size, + format, args + ); #ifndef HAVE_C99_SNPRINTF // Assume we're on Windows. if (len < 0) { -- cgit v1.2.3