From ab0b26258655cec93019ca6e463813391d258eba Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Fri, 22 Mar 2024 07:26:09 +0100 Subject: [PATCH] [fixup] remove unnecessarily complicated and unreliable asserts --- src/common/buf.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/common/buf.c b/src/common/buf.c index 1b73535d..31ecdce6 100644 --- a/src/common/buf.c +++ b/src/common/buf.c @@ -7,29 +7,17 @@ #define BUF_INITIAL_SIZE 256 -#define BUF_CLEARED(s) ((s) && !(s)->buf && !(s)->alloc && !(s)->len) -#define BUF_INITIALIZED(s) ((s) && (s)->buf && (s)->alloc >= BUF_INITIAL_SIZE) - /* * Replace dst by src, src is invalid after this call * but it may be reused when calling buf_init(src). * * dst must either have been initialized with buf_init() - * or cleared out (e.g. created by znew() or on the stack - * like struct buf foo = {0}). + * or zeroed out (e.g. created by znew() or on the stack + * with something like struct buf foo = {0}). */ static void buf_replace_by(struct buf *dst, struct buf *src) { - assert(dst); - assert(BUF_INITIALIZED(src)); - - /* - * Tries to ensure that we don't accidentally try - * to free a random uninitialized dst->buf pointer - */ - assert(BUF_CLEARED(dst) || BUF_INITIALIZED(dst)); - free(dst->buf); *dst = *src;