From 62cb38bf8a826125fba0034221343aa70dd3d415 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 27 Jul 2015 21:35:54 -0700 Subject: Use clang-format, llvm style, for formatting. * Reformatted all source files. * Added 'format' target to Makefile. * Removed 'astyle' target. * Updated .editorconfig. --- src/buffer.h | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/buffer.h') diff --git a/src/buffer.h b/src/buffer.h index 36ae0a1..e99db72 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -14,13 +14,14 @@ extern "C" { typedef int bufsize_t; typedef struct { - unsigned char *ptr; - bufsize_t asize, size; + unsigned char *ptr; + bufsize_t asize, size; } cmark_strbuf; extern unsigned char cmark_strbuf__initbuf[]; -#define GH_BUF_INIT { cmark_strbuf__initbuf, 0, 0 } +#define GH_BUF_INIT \ + { cmark_strbuf__initbuf, 0, 0 } #define BUFSIZE_MAX INT_MAX /** @@ -44,19 +45,21 @@ bufsize_t cmark_strbuf_len(const cmark_strbuf *buf); int cmark_strbuf_cmp(const cmark_strbuf *a, const cmark_strbuf *b); unsigned char *cmark_strbuf_detach(cmark_strbuf *buf); -void cmark_strbuf_copy_cstr(char *data, bufsize_t datasize, const cmark_strbuf *buf); +void cmark_strbuf_copy_cstr(char *data, bufsize_t datasize, + const cmark_strbuf *buf); -static inline const char *cmark_strbuf_cstr(const cmark_strbuf *buf) -{ - return (char *)buf->ptr; +static inline const char *cmark_strbuf_cstr(const cmark_strbuf *buf) { + return (char *)buf->ptr; } #define cmark_strbuf_at(buf, n) ((buf)->ptr[n]) -void cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, bufsize_t len); +void cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, + bufsize_t len); void cmark_strbuf_sets(cmark_strbuf *buf, const char *string); void cmark_strbuf_putc(cmark_strbuf *buf, int c); -void cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, bufsize_t len); +void cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, + bufsize_t len); void cmark_strbuf_puts(cmark_strbuf *buf, const char *string); void cmark_strbuf_clear(cmark_strbuf *buf); @@ -72,17 +75,15 @@ void cmark_strbuf_unescape(cmark_strbuf *s); /* Print error and abort. */ void cmark_strbuf_overflow_err(void); -static inline bufsize_t -cmark_strbuf_check_bufsize(size_t size) { - if (size > BUFSIZE_MAX) { - cmark_strbuf_overflow_err(); - } - return (bufsize_t)size; +static inline bufsize_t cmark_strbuf_check_bufsize(size_t size) { + if (size > BUFSIZE_MAX) { + cmark_strbuf_overflow_err(); + } + return (bufsize_t)size; } -static inline bufsize_t -cmark_strbuf_safe_strlen(const char *str) { - return cmark_strbuf_check_bufsize(strlen(str)); +static inline bufsize_t cmark_strbuf_safe_strlen(const char *str) { + return cmark_strbuf_check_bufsize(strlen(str)); } #ifdef __cplusplus -- cgit v1.2.3