From 0a1b15b307c3194c8da703a3ba832ed9277b4c72 Mon Sep 17 00:00:00 2001 From: Martin Michalec Date: Fri, 6 Nov 2026 05:56:27 +0300 Subject: feat(bump): add bump allocator --- include/bump.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/bump.h (limited to 'include') diff --git a/include/bump.h b/include/bump.h new file mode 100644 index 0000000..49dbc64 --- /dev/null +++ b/include/bump.h @@ -0,0 +1,34 @@ +// bump.h --- bump allocator -*- C -*- +// +// Copyright (c) 2026 Martin Michalec +// +// SPDX-License-Identifier: MIT +// +// This file is part of COSMOS Codebase. +// +// Commentary: +// +// HOLD(cmmm): add direct bump API. +// +// Code: + +#ifndef INCLUDED_COSMOS_BUMP_H +#define INCLUDED_COSMOS_BUMP_H + +#include "buf.h" + +struct bump { + struct buf buf; //!< Backing memory buffer. +}; + +#ifndef BUMP_NO_FEAT_GPA +#include "gpa.h" + +void *gpa_fun_bump (void *ctx, void *ptr, usz old_sz, usz new_sz, usz align); +struct gpa gpa_from_bump (struct bump *); + +#endif // BUMP_NO_FEAT_GPA + +#endif // INCLUDED_COSMOS_BUMP_H + +// bump.h ends here -- cgit v1.3.1