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