2 Copyright © 2002-2003, The AROS Development Team. All rights reserved.
5 AllocVec-based string duplication.
8 #include "alib_intern.h"
9 #include <exec/memory.h>
12 /*****************************************************************************
15 #define NO_INLINE_STDARG /* turn off inline def */
16 #include <proto/exec.h>
24 This function allocates enough space, and copies the given string
28 str - the string to duplicate
31 A string copy of the original string (possibly of zero length) or
32 NULL if passed a NULL pointer.
35 This functions allocates the new string memory with AllocVec().
36 Don't forget to call FreeVec() when you're done with it.
43 AllocVec(), FreeVec(), CopyMem()
47 *****************************************************************************/
52 if (str
== NULL
) return NULL
;
55 dup
= AllocVec(len
+ 1, MEMF_PUBLIC
);
56 if (dup
!= NULL
) CopyMem(str
, dup
, len
+ 1);