core: ptrbox: Add ptrbox_malloc() function

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-03-21 19:01:30 -04:00
parent 7c0f40abbf
commit 2e4f11bfcc
2 changed files with 33 additions and 0 deletions

View File

@@ -60,6 +60,17 @@ int ptrbox_init(struct ptrbox *ptrbox);
*/
char *ptrbox_strdup(struct ptrbox *ptrbox, const char *s);
/*
* Allocate a number of bytes on the heap and store the reference
*
* @ptrbox: Pointer box
* @length: Number of bytes to allocate
*
* Returns the base of the allocated memory on success, otherwise
* NULL on failure.
*/
void *ptrbox_malloc(struct ptrbox *ptrbox, size_t length);
/*
* Destroy all elements within a pointer box
*