1 // This file is under GNU General Public License 3.0
7 #include "dynamic_api.h"
14 // new_string() - allocate a new string
17 // src (in) string to copy or NULL
18 // len (in) length of newly created string or 0 for default
21 // pointer to string object or NULL if out of memory
23 // calling with str and len is equivalent to strndup()
24 // calling with str but len=0 is equivalent to strdup()
25 // calling with str=NULL is equivalent to calloc()
27 DYNAMIC_API char * new_string(const char *src, size_t len);
30 // free_string() - free memory occupied by string
33 // s (in) pointer to string to free
35 DYNAMIC_API void free_string(char *s);
38 // string_dup() - duplicate a string
41 // src (in) string to duplicate
42 // len (in) length of newly created string or 0 for default
45 // pointer to copy or NULL if out of memory
47 DYNAMIC_API char * string_dup(const char *src, size_t len);