From 0cc9b20c15460213e488bf5e70963b941482f628 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Tue, 14 Jan 2025 16:06:02 -0600 Subject: Add source. --- sdk/other/memdup.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 sdk/other/memdup.c (limited to 'sdk/other/memdup.c') diff --git a/sdk/other/memdup.c b/sdk/other/memdup.c new file mode 100644 index 0000000..af1f3cf --- /dev/null +++ b/sdk/other/memdup.c @@ -0,0 +1,22 @@ +/* + * Duplicate object into a memory pool. + * $Id$ + * Copyright (c) 1997 by Tycho Softworks. + * For conditions of distribution and reuse see product license. + */ + +#include +#include + +void *memdup(void *obj, size_t size) +{ + void *new = (void *)malloc(size); + + if(!new) + return NULL; + + memcpy(new, obj, size); + return new; +} + + -- cgit v1.2.3-54-g00ecf