SCLogDebug("storage %p id %d", storage, id);
if (storage == NULL)
return NULL;
- return storage[id];
+ return storage[id].ptr;
}
int StorageSetById(Storage *storage, const StorageEnum type, const int id, void *ptr)
SCLogDebug("storage %p id %d", storage, id);
if (storage == NULL)
return -1;
- storage[id] = ptr;
+ storage[id].ptr = ptr;
return 0;
}
SCLogDebug("storage %p id %d", storage, id);
StorageMapping *map = &storage_map[type][id];
- if (storage[id] == NULL && map->Alloc != NULL) {
- storage[id] = map->Alloc(map->size);
- if (storage[id] == NULL) {
+ if (storage[id].ptr == NULL && map->Alloc != NULL) {
+ storage[id].ptr = map->Alloc(map->size);
+ if (storage[id].ptr == NULL) {
return NULL;
}
}
- return storage[id];
+ return storage[id].ptr;
}
void StorageFreeById(Storage *storage, StorageEnum type, int id)
Storage *store = storage;
if (store != NULL) {
SCLogDebug("store %p", store);
- if (store[id] != NULL) {
+ if (store[id].ptr != NULL) {
StorageMapping *map = &storage_map[type][id];
- map->Free(store[id]);
- store[id] = NULL;
+ map->Free(store[id].ptr);
+ store[id].ptr = NULL;
}
}
}
Storage *store = storage;
int i;
for (i = 0; i < storage_max_id[type]; i++) {
- if (store[i] != NULL) {
+ if (store[i].ptr != NULL) {
StorageMapping *map = &storage_map[type][i];
- map->Free(store[i]);
- store[i] = NULL;
+ map->Free(store[i].ptr);
+ store[i].ptr = NULL;
}
}
}