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

36 lines
725 B

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