From: Victor Julien Date: Sat, 16 Nov 2019 14:56:15 +0000 (+0100) Subject: output: micro optimization X-Git-Tag: suricata-6.0.0-beta1~832 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5b7aa506c169361ad30a25c113b8275dfe58c799;p=thirdparty%2Fsuricata.git output: micro optimization LogFunc is always set, so don't check for it at runtime. --- diff --git a/src/output.c b/src/output.c index 1f234115ab..a5f9b2deee 100644 --- a/src/output.c +++ b/src/output.c @@ -929,9 +929,8 @@ TmEcode OutputLoggerLog(ThreadVars *tv, Packet *p, void *thread_data) RootLogger *logger = TAILQ_FIRST(&active_loggers); LoggerThreadStoreNode *thread_store_node = TAILQ_FIRST(thread_store); while (logger && thread_store_node) { - if (logger->LogFunc != NULL) { - logger->LogFunc(tv, p, thread_store_node->thread_data); - } + logger->LogFunc(tv, p, thread_store_node->thread_data); + logger = TAILQ_NEXT(logger, entries); thread_store_node = TAILQ_NEXT(thread_store_node, entries); } @@ -1015,6 +1014,8 @@ void OutputRegisterRootLogger(ThreadInitFunc ThreadInit, ThreadExitPrintStatsFunc ThreadExitPrintStats, OutputLogFunc LogFunc, OutputGetActiveCountFunc ActiveCntFunc) { + BUG_ON(LogFunc == NULL); + RootLogger *logger = SCCalloc(1, sizeof(*logger)); if (logger == NULL) { FatalError(SC_ERR_MEM_ALLOC, "failed to alloc root logger");