From 715d3d48f962d17575ff9de0034f2ac89b59f975 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Wed, 26 Sep 2018 15:29:17 +0300 Subject: Goodbye C compiler, hello colm compiler --- src/util/membuf.c | 31 ------------------------------- src/util/membuf.h | 14 -------------- 2 files changed, 45 deletions(-) delete mode 100644 src/util/membuf.c delete mode 100644 src/util/membuf.h (limited to 'src/util') diff --git a/src/util/membuf.c b/src/util/membuf.c deleted file mode 100644 index 0602679..0000000 --- a/src/util/membuf.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "membuf.h" - -#include -#include -#include -#include - -static void -membuf_bounds_check(const struct membuf *buf, const size_t nmemb) -{ - assert(buf); - - if (buf->mem.len < nmemb || buf->written > buf->mem.len - nmemb) - errx(EXIT_FAILURE, "%s: %zu bytes exceeds the maximum storage size of %zu bytes", __func__, buf->written + nmemb, buf->mem.len); -} - -void -membuf_terminate(struct membuf *buf, const void *data, const size_t data_sz) -{ - assert(data || !data_sz); - membuf_bounds_check(buf, data_sz); - memcpy((char*)buf->mem.data + buf->written, data, data_sz); -} - -void -membuf_append(struct membuf *buf, const void *data, const size_t data_sz) -{ - membuf_terminate(buf, data, data_sz); - buf->written += data_sz; - assert(buf->written <= buf->mem.len); -} diff --git a/src/util/membuf.h b/src/util/membuf.h deleted file mode 100644 index 86d8dde..0000000 --- a/src/util/membuf.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -struct membuf { - struct fspec_mem mem; - size_t written; -}; - -void -membuf_terminate(struct membuf *buf, const void *data, const size_t data_sz); - -void -membuf_append(struct membuf *buf, const void *data, const size_t data_sz); -- cgit v1.2.3-70-g09d2