]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output: micro optimization
authorVictor Julien <victor@inliniac.net>
Sat, 16 Nov 2019 14:56:15 +0000 (15:56 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 27 Jan 2020 19:20:08 +0000 (20:20 +0100)
LogFunc is always set, so don't check for it at runtime.

src/output.c

index 1f234115ab592dac3153588e44be36a8815ca72e..a5f9b2deee5a8a31b72b16df859f9a1e3843f6ea 100644 (file)
@@ -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");