From 01c427f6be4019db3f01ec3a65148791b36bb000 Mon Sep 17 00:00:00 2001 From: szedenik-adam Date: Thu, 7 Aug 2025 10:23:50 +0200 Subject: [PATCH] Replaced initializer list with in-class initializer in AuditLog --- headers/modsecurity/audit_log.h | 26 +++++++++++++------------- src/audit_log/audit_log.cc | 15 +-------------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/headers/modsecurity/audit_log.h b/headers/modsecurity/audit_log.h index 42d4e6ba..d1a6c3ab 100644 --- a/headers/modsecurity/audit_log.h +++ b/headers/modsecurity/audit_log.h @@ -183,32 +183,32 @@ class AuditLog { bool merge(AuditLog *from, std::string *error); - std::string m_path1; - std::string m_path2; - std::string m_storage_dir; - std::string m_header; + std::string m_path1 = std::string(""); + std::string m_path2 = std::string(""); + std::string m_storage_dir = std::string(""); + std::string m_header = std::string(""); - AuditLogFormat m_format; + AuditLogFormat m_format = NotSetAuditLogFormat; protected: - int m_parts; + int m_parts = -1; int m_defaultParts = AAuditLogPart | BAuditLogPart | CAuditLogPart | FAuditLogPart | HAuditLogPart | ZAuditLogPart; - int m_filePermission; + int m_filePermission = -1; int m_defaultFilePermission = 0640; - int m_directoryPermission; + int m_directoryPermission = -1; int m_defaultDirectoryPermission = 0750; private: - AuditLogStatus m_status; + AuditLogStatus m_status = NotSetLogStatus; - AuditLogType m_type; - std::string m_relevant; + AuditLogType m_type = NotSetAuditLogType; + std::string m_relevant = std::string(""); - audit_log::writer::Writer *m_writer; - bool m_ctlAuditEngineActive; // rules have at least one action On or RelevantOnly + audit_log::writer::Writer *m_writer = NULL; + bool m_ctlAuditEngineActive = false; // rules have at least one action On or RelevantOnly }; diff --git a/src/audit_log/audit_log.cc b/src/audit_log/audit_log.cc index 397edefb..18d1d529 100644 --- a/src/audit_log/audit_log.cc +++ b/src/audit_log/audit_log.cc @@ -51,20 +51,7 @@ namespace modsecurity { namespace audit_log { -AuditLog::AuditLog() - : m_path1(""), - m_path2(""), - m_storage_dir(""), - m_header(""), - m_format(NotSetAuditLogFormat), - m_parts(-1), - m_filePermission(-1), - m_directoryPermission(-1), - m_status(NotSetLogStatus), - m_type(NotSetAuditLogType), - m_relevant(""), - m_writer(NULL), - m_ctlAuditEngineActive(false) { } +AuditLog::AuditLog() { } AuditLog::~AuditLog() {