atomics: remove useless SC_ATOMIC_DESTROY

pull/4832/head
Victor Julien 5 years ago
parent 1cb7eec52d
commit c660757153

@ -195,13 +195,6 @@ void HTPFree(void *ptr, size_t size)
HTPDecrMemuse((uint64_t)size); HTPDecrMemuse((uint64_t)size);
} }
void HTPDestroyMemcap(void)
{
SC_ATOMIC_DESTROY(htp_config_memcap);
SC_ATOMIC_DESTROY(htp_memcap);
SC_ATOMIC_DESTROY(htp_memuse);
}
/** /**
* @} * @}
*/ */

@ -22,7 +22,6 @@ void *HTPMalloc(size_t size);
void *HTPCalloc(size_t n, size_t size); void *HTPCalloc(size_t n, size_t size);
void *HTPRealloc(void *ptr, size_t orig_size, size_t size); void *HTPRealloc(void *ptr, size_t orig_size, size_t size);
void HTPFree(void *ptr, size_t size); void HTPFree(void *ptr, size_t size);
void HTPDestroyMemcap(void);
int HTPSetMemcap(uint64_t size); int HTPSetMemcap(uint64_t size);
uint64_t HTPGetMemcap(void); uint64_t HTPGetMemcap(void);

@ -2083,7 +2083,6 @@ void HTPFreeConfig(void)
htp_config_destroy(htprec->cfg); htp_config_destroy(htprec->cfg);
SCFree(htprec); SCFree(htprec);
} }
HTPDestroyMemcap();
SCReturn; SCReturn;
} }

@ -156,7 +156,6 @@ void DefragTrackerRelease(DefragTracker *t)
void DefragTrackerClearMemory(DefragTracker *dt) void DefragTrackerClearMemory(DefragTracker *dt)
{ {
DefragTrackerFreeFrags(dt); DefragTrackerFreeFrags(dt);
SC_ATOMIC_DESTROY(dt->use_cnt);
} }
#define DEFRAG_DEFAULT_HASHSIZE 4096 #define DEFRAG_DEFAULT_HASHSIZE 4096
@ -329,12 +328,6 @@ void DefragHashShutdown(void)
} }
(void) SC_ATOMIC_SUB(defrag_memuse, defrag_config.hash_size * sizeof(DefragTrackerHashRow)); (void) SC_ATOMIC_SUB(defrag_memuse, defrag_config.hash_size * sizeof(DefragTrackerHashRow));
DefragTrackerQueueDestroy(&defragtracker_spare_q); DefragTrackerQueueDestroy(&defragtracker_spare_q);
SC_ATOMIC_DESTROY(defragtracker_prune_idx);
SC_ATOMIC_DESTROY(defrag_memuse);
SC_ATOMIC_DESTROY(defragtracker_counter);
SC_ATOMIC_DESTROY(defrag_config.memcap);
//SC_ATOMIC_DESTROY(flow_flags);
return; return;
} }

@ -75,7 +75,6 @@ void TagDestroyCtx(void)
#ifdef DEBUG #ifdef DEBUG
BUG_ON(SC_ATOMIC_GET(num_tags) != 0); BUG_ON(SC_ATOMIC_GET(num_tags) != 0);
#endif #endif
SC_ATOMIC_DESTROY(num_tags);
} }
/** \brief Reset the tagging engine context /** \brief Reset the tagging engine context

@ -120,8 +120,6 @@
#define FLOW_DESTROY(f) do { \ #define FLOW_DESTROY(f) do { \
FlowCleanupAppLayer((f)); \ FlowCleanupAppLayer((f)); \
SC_ATOMIC_DESTROY((f)->flow_state); \
SC_ATOMIC_DESTROY((f)->use_cnt); \
\ \
FLOWLOCK_DESTROY((f)); \ FLOWLOCK_DESTROY((f)); \
GenericVarFree((f)->flowvar); \ GenericVarFree((f)->flowvar); \

@ -170,7 +170,6 @@ static TmEcode FlowWorkerThreadDeinit(ThreadVars *tv, void *data)
/* free pq */ /* free pq */
BUG_ON(fw->pq.len); BUG_ON(fw->pq.len);
SC_ATOMIC_DESTROY(fw->detect_thread);
SCFree(fw); SCFree(fw);
return TM_ECODE_OK; return TM_ECODE_OK;
} }

@ -714,7 +714,6 @@ void FlowShutdown(void)
} }
FBLOCK_DESTROY(&flow_hash[u]); FBLOCK_DESTROY(&flow_hash[u]);
SC_ATOMIC_DESTROY(flow_hash[u].next_ts);
} }
SCFreeAligned(flow_hash); SCFreeAligned(flow_hash);
flow_hash = NULL; flow_hash = NULL;
@ -722,11 +721,6 @@ void FlowShutdown(void)
(void) SC_ATOMIC_SUB(flow_memuse, flow_config.hash_size * sizeof(FlowBucket)); (void) SC_ATOMIC_SUB(flow_memuse, flow_config.hash_size * sizeof(FlowBucket));
FlowQueueDestroy(&flow_spare_q); FlowQueueDestroy(&flow_spare_q);
FlowQueueDestroy(&flow_recycle_q); FlowQueueDestroy(&flow_recycle_q);
SC_ATOMIC_DESTROY(flow_config.memcap);
SC_ATOMIC_DESTROY(flow_prune_idx);
SC_ATOMIC_DESTROY(flow_memuse);
SC_ATOMIC_DESTROY(flow_flags);
return; return;
} }

@ -132,8 +132,6 @@ void HostFree(Host *h)
{ {
if (h != NULL) { if (h != NULL) {
HostClearMemory(h); HostClearMemory(h);
SC_ATOMIC_DESTROY(h->use_cnt);
SCMutexDestroy(&h->m); SCMutexDestroy(&h->m);
SCFree(h); SCFree(h);
(void) SC_ATOMIC_SUB(host_memuse, g_host_size); (void) SC_ATOMIC_SUB(host_memuse, g_host_size);
@ -334,12 +332,6 @@ void HostShutdown(void)
} }
(void) SC_ATOMIC_SUB(host_memuse, host_config.hash_size * sizeof(HostHashRow)); (void) SC_ATOMIC_SUB(host_memuse, host_config.hash_size * sizeof(HostHashRow));
HostQueueDestroy(&host_spare_q); HostQueueDestroy(&host_spare_q);
SC_ATOMIC_DESTROY(host_prune_idx);
SC_ATOMIC_DESTROY(host_memuse);
SC_ATOMIC_DESTROY(host_counter);
SC_ATOMIC_DESTROY(host_config.memcap);
//SC_ATOMIC_DESTROY(flow_flags);
return; return;
} }

@ -131,8 +131,6 @@ void IPPairFree(IPPair *h)
{ {
if (h != NULL) { if (h != NULL) {
IPPairClearMemory(h); IPPairClearMemory(h);
SC_ATOMIC_DESTROY(h->use_cnt);
SCMutexDestroy(&h->m); SCMutexDestroy(&h->m);
SCFree(h); SCFree(h);
(void) SC_ATOMIC_SUB(ippair_memuse, g_ippair_size); (void) SC_ATOMIC_SUB(ippair_memuse, g_ippair_size);
@ -329,12 +327,6 @@ void IPPairShutdown(void)
} }
(void) SC_ATOMIC_SUB(ippair_memuse, ippair_config.hash_size * sizeof(IPPairHashRow)); (void) SC_ATOMIC_SUB(ippair_memuse, ippair_config.hash_size * sizeof(IPPairHashRow));
IPPairQueueDestroy(&ippair_spare_q); IPPairQueueDestroy(&ippair_spare_q);
SC_ATOMIC_DESTROY(ippair_prune_idx);
SC_ATOMIC_DESTROY(ippair_memuse);
SC_ATOMIC_DESTROY(ippair_counter);
SC_ATOMIC_DESTROY(ippair_config.memcap);
//SC_ATOMIC_DESTROY(flow_flags);
return; return;
} }

@ -384,9 +384,6 @@ static void AFPPeerClean(AFPPeer *peer)
{ {
if (peer->flags & AFP_SOCK_PROTECT) if (peer->flags & AFP_SOCK_PROTECT)
SCMutexDestroy(&peer->sock_protect); SCMutexDestroy(&peer->sock_protect);
SC_ATOMIC_DESTROY(peer->socket);
SC_ATOMIC_DESTROY(peer->if_idx);
SC_ATOMIC_DESTROY(peer->state);
SCFree(peer); SCFree(peer);
} }

@ -668,9 +668,6 @@ void StreamTcpInitConfig(char quiet)
void StreamTcpFreeConfig(char quiet) void StreamTcpFreeConfig(char quiet)
{ {
SC_ATOMIC_DESTROY(stream_config.memcap);
SC_ATOMIC_DESTROY(stream_config.reassembly_memcap);
StreamTcpReassembleFree(quiet); StreamTcpReassembleFree(quiet);
SCMutexLock(&ssn_pool_mutex); SCMutexLock(&ssn_pool_mutex);

@ -371,8 +371,6 @@ static void GlobalsDestroy(SCInstance *suri)
NFQContextsClean(); NFQContextsClean();
#endif #endif
SC_ATOMIC_DESTROY(engine_stage);
#ifdef BUILD_HYPERSCAN #ifdef BUILD_HYPERSCAN
MpmHSGlobalCleanup(); MpmHSGlobalCleanup();
#endif #endif

@ -433,8 +433,6 @@ void PacketPoolDestroy(void)
PacketFree(p); PacketFree(p);
} }
SC_ATOMIC_DESTROY(my_pool->return_stack.sync_now);
#ifdef DEBUG_VALIDATION #ifdef DEBUG_VALIDATION
my_pool->initialized = 0; my_pool->initialized = 0;
my_pool->destroyed = 1; my_pool->destroyed = 1;

@ -178,11 +178,6 @@
#define SC_ATOMIC_RESET(name) \ #define SC_ATOMIC_RESET(name) \
(name ## _sc_atomic__) = 0 (name ## _sc_atomic__) = 0
/**
* \brief No-op.
*/
#define SC_ATOMIC_DESTROY(name)
/** /**
* \brief add a value to our atomic variable * \brief add a value to our atomic variable
* *

@ -364,9 +364,6 @@ int LiveDeviceListClean()
if (pd->dev) if (pd->dev)
SCFree(pd->dev); SCFree(pd->dev);
SC_ATOMIC_DESTROY(pd->pkts);
SC_ATOMIC_DESTROY(pd->drop);
SC_ATOMIC_DESTROY(pd->invalid_checksums);
LiveDevFreeStorage(pd); LiveDevFreeStorage(pd);
SCFree(pd); SCFree(pd);
} }

@ -189,8 +189,6 @@ static void THashDataFree(THashTableContext *ctx, THashData *h)
if (h->data != NULL) { if (h->data != NULL) {
ctx->config.DataFree(h->data); ctx->config.DataFree(h->data);
} }
SC_ATOMIC_DESTROY(h->use_cnt);
SCMutexDestroy(&h->m); SCMutexDestroy(&h->m);
SCFree(h); SCFree(h);
(void) SC_ATOMIC_SUB(ctx->memuse, THASH_DATA_SIZE(ctx)); (void) SC_ATOMIC_SUB(ctx->memuse, THASH_DATA_SIZE(ctx));
@ -352,11 +350,6 @@ void THashShutdown(THashTableContext *ctx)
} }
(void) SC_ATOMIC_SUB(ctx->memuse, ctx->config.hash_size * sizeof(THashHashRow)); (void) SC_ATOMIC_SUB(ctx->memuse, ctx->config.hash_size * sizeof(THashHashRow));
THashDataQueueDestroy(&ctx->spare_q); THashDataQueueDestroy(&ctx->spare_q);
SC_ATOMIC_DESTROY(ctx->prune_idx);
SC_ATOMIC_DESTROY(ctx->memuse);
SC_ATOMIC_DESTROY(ctx->counter);
SCFree(ctx); SCFree(ctx);
return; return;
} }

Loading…
Cancel
Save