From 9ceb2b27577f1be3f30edb40a45117066fc78c51 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 19 Jun 2023 12:08:10 -0400 Subject: bfstd: New xmemdup() function --- src/bfstd.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/bfstd.h') diff --git a/src/bfstd.h b/src/bfstd.h index 750847e..6f2e21e 100644 --- a/src/bfstd.h +++ b/src/bfstd.h @@ -126,6 +126,18 @@ int ynprompt(void); // #include +/** + * Allocate a copy of a region of memory. + * + * @param src + * The memory region to copy. + * @param size + * The size of the memory region. + * @return + * A copy of the region, allocated with malloc(), or NULL on failure. + */ +void *xmemdup(const void *src, size_t size); + /** * Format a mode like ls -l (e.g. -rw-r--r--). * -- cgit v1.2.3