From 7ade0aa1d22367cb0d998d35573dc5e333a41f75 Mon Sep 17 00:00:00 2001 From: "Christopher R. Hertel" Date: Wed, 15 Jul 1998 20:15:25 +0000 Subject: util.c: I've added a function called mem_dup(). Similar to strdup(), mem_dup() allocates the required memory before copying the source data. It returns NULL if memory could not be allcoated, else a pointer to the newly allocated memory. proto.h: Rebuilt to add the prototype for mem_dup(). (This used to be commit 7f7e265ab457d046441d502d4b8447bc2c966675) --- source3/lib/util.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/util.c b/source3/lib/util.c index 2bd7636fb0..905809f111 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -516,6 +516,19 @@ void *MemMove(void *dest,void *src,int size) } #endif +/* ************************************************************************* ** + * Duplicate a block of memory. + * ************************************************************************* ** + */ +void *mem_dup( void *from, int size ) + { + void *tmp; + + tmp = malloc( size ); + if( NULL != tmp ) + (void)memcpy( tmp, from, size ); + return( tmp ); + } /* mem_dup */ /**************************************************************************** prompte a dptr (to make it recently used) -- cgit