Go to the documentation of this file.
57 void *(*Alloc)(
unsigned int),
void (*Free)(
void *))
66 static void *StorageTestAlloc(
unsigned int size)
71 static void StorageTestFree(
void *x)
76 static int ThreadStorageTest01(
void)
128 static int ThreadStorageTest02(
void)
156 static int ThreadStorageTest03(
void)
void StorageFreeAll(Storage *storage, StorageEnum type)
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
const StorageEnum storage_type
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
void StorageCleanup(void)
void * ThreadAllocStorageById(ThreadVars *tv, ThreadStorageId id)
enum StorageEnum_ StorageEnum
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
#define PASS
Pass the test.
Per thread variable structure.
int StorageFinalize(void)
ThreadStorageId ThreadStorageRegister(const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
void ThreadFreeStorageById(ThreadVars *tv, ThreadStorageId id)
int StorageSetById(Storage *storage, const StorageEnum type, const int id, void *ptr)
set storage for id
void * StorageAllocByIdPrealloc(Storage *storage, StorageEnum type, int id)
AllocById func for prealloc'd base storage (storage ptrs are part of another memory block)
unsigned int ThreadStorageSize(void)
void StorageFreeById(Storage *storage, StorageEnum type, int id)
void * ThreadGetStorageById(const ThreadVars *tv, ThreadStorageId id)
void RegisterThreadStorageTests(void)
int ThreadSetStorageById(ThreadVars *tv, ThreadStorageId id, void *ptr)
void ThreadFreeStorage(ThreadVars *tv)
void * StorageGetById(const Storage *storage, const StorageEnum type, const int id)
get storage for id
unsigned int StorageGetSize(StorageEnum type)
get the size of the void array used to store the pointers
int StorageRegister(const StorageEnum type, const char *name, const unsigned int size, void *(*Alloc)(unsigned int), void(*Free)(void *))
Register new storage.