You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
configreader/containers/stringarray.c

37 lines
763 B

#include "stringarray.h"
#include <proto/containerkit.h>
#include <proto/exec.h>
#include <string.h>
StringArray StringArrayNew(VOID)
{
#define SIZE_STRPTR 2
return NewArray(SIZE_STRPTR);
}
VOID StringArrayAppend(StringArray array, CONST_STRPTR value)
{
AppendToArray(CONST_STRPTR, array, value);
}
VOID StringArrayAppendAndRetain(StringArray array, CONST_STRPTR value)
{
STRPTR localCopy = AllocVec(strlen(value)+1, MEMF_CLEAR);
CopyMem(value, localCopy, strlen(value));
StringArrayAppend(array, localCopy);
}
VOID StringArrayFree(StringArray array)
{
if( array != NULL )
{
StringArrayForEach(array, FreeVec(aString););
DeleteArray(array);
}
}
CONST_STRPTR* StringArrayValues(StringArray array)
{
return ArrayValues(CONST_STRPTR, array);
}