From f74c418f47cb33ab7f7a5cdb6d922791f94aab5d Mon Sep 17 00:00:00 2001 From: Dan Cross Date: Tue, 9 Oct 2018 17:12:43 +0000 Subject: [PATCH] clang-format: Minor whitespace issues. These are entirely my fault, sadly. Signed-off-by: Dan Cross --- src/bbs.h | 6 +++--- src/util.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bbs.h b/src/bbs.h index b78de7d..caf2f62 100644 --- a/src/bbs.h +++ b/src/bbs.h @@ -261,9 +261,9 @@ struct blog_entry_t { }; struct ptr_vector { - size_t len; - size_t capacity; - void **ptrs; + size_t len; + size_t capacity; + void **ptrs; }; extern void init_ptr_vector(struct ptr_vector *vec); diff --git a/src/util.c b/src/util.c index 6bfd491..4f846db 100644 --- a/src/util.c +++ b/src/util.c @@ -134,17 +134,17 @@ int ptr_vector_append(struct ptr_vector *vec, void *p) { if (vec->len == vec->capacity) { void **ps; size_t oldcap = vec->capacity; - if (vec->capacity == 0) - vec->capacity = 1; - else + if (vec->capacity == 0) + vec->capacity = 1; + else vec->capacity *= 2; - ps = realloc(vec->ptrs, vec->capacity * sizeof(void *)); - assert(ps != NULL); + ps = realloc(vec->ptrs, vec->capacity * sizeof(void *)); + assert(ps != NULL); memset(vec->ptrs + oldcap, 0, (vec->capacity - oldcap) * sizeof(void *)); - vec->ptrs = ps; - } - vec->ptrs[vec->len] = p; - ++vec->len; + vec->ptrs = ps; + } + vec->ptrs[vec->len] = p; + ++vec->len; return 1; }