codebased/include/utils/string_array.h
2023-04-13 02:29:49 +02:00

39 lines
950 B
C

#ifndef UTILS_STRING_ARRAY_H
#define UTILS_STRING_ARRAY_H
#include "utils/generic_array.h"
#include "utils/string.h"
#include <stdlib.h>
GENERIC_ARRAY(StringView, StringViewArray, stringview_array)
typedef struct StringViewArray StringViewArray;
static inline StringViewArray* stringview_array_new(void)
{
StringViewArray* array = malloc(sizeof(StringViewArray));
stringview_array_construct(array);
return array;
}
static inline void stringview_array_delete(StringViewArray* array)
{
stringview_array_destroy(array);
free(array);
}
GENERIC_ARRAY(HeapString, HeapStringArray, heapstring_array)
typedef struct HeapStringArray HeapStringArray;
static inline HeapStringArray* heapstring_array_new(void)
{
HeapStringArray* array = malloc(sizeof(HeapStringArray));
heapstring_array_construct(array);
return array;
}
static inline void heapstring_array_delete(HeapStringArray* array)
{
heapstring_array_destroy(array);
free(array);
}
#endif