Skip to content

Commit 31fb939

Browse files
committed
Replaced string parameters with string_view in AuditLog
1 parent 2ee45de commit 31fb939

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

headers/modsecurity/audit_log.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,18 @@ class AuditLog {
153153
bool setStorageDirMode(int permission);
154154
bool setFileMode(int permission);
155155
bool setStatus(AuditLogStatus new_status);
156-
bool setRelevantStatus(const std::basic_string<char>& new_relevant_status);
157-
bool setFilePath1(const std::basic_string<char>& path);
158-
bool setFilePath2(const std::basic_string<char>& path);
159-
bool setStorageDir(const std::basic_string<char>& path);
160-
bool setHeader(const std::basic_string<char>& header);
156+
bool setRelevantStatus(std::string_view new_relevant_status);
157+
bool setFilePath1(std::string_view path);
158+
bool setFilePath2(std::string_view path);
159+
bool setStorageDir(std::string_view path);
160+
bool setHeader(std::string_view header);
161161
bool setFormat(AuditLogFormat fmt);
162162

163163
int getDirectoryPermission() const;
164164
int getFilePermission() const;
165165
int getParts() const;
166166

167-
bool setParts(const std::basic_string<char>& new_parts);
167+
bool setParts(std::string_view new_parts);
168168
bool setType(AuditLogType audit_type);
169169

170170
bool init(std::string *error);
@@ -174,8 +174,8 @@ class AuditLog {
174174
bool saveIfRelevant(Transaction *transaction, int parts);
175175
bool isRelevant(int status);
176176

177-
static int addParts(int parts, const std::string& new_parts);
178-
static int removeParts(int parts, const std::string& new_parts);
177+
static int addParts(int parts, std::string_view new_parts);
178+
static int removeParts(int parts, std::string_view new_parts);
179179

180180
void setCtlAuditEngineActive() {
181181
m_ctlAuditEngineActive = true;

src/audit_log/audit_log.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,31 +109,31 @@ bool AuditLog::setStatus(AuditLogStatus status) {
109109
}
110110

111111

112-
bool AuditLog::setRelevantStatus(const std::basic_string<char>& status) {
112+
bool AuditLog::setRelevantStatus(std::string_view status) {
113113
this->m_relevant = std::string(status);
114114
return true;
115115
}
116116

117117

118-
bool AuditLog::setStorageDir(const std::basic_string<char>& path) {
118+
bool AuditLog::setStorageDir(std::string_view path) {
119119
this->m_storage_dir = path;
120120
return true;
121121
}
122122

123123

124-
bool AuditLog::setFilePath1(const std::basic_string<char>& path) {
124+
bool AuditLog::setFilePath1(std::string_view path) {
125125
this->m_path1 = path;
126126
return true;
127127
}
128128

129129

130-
bool AuditLog::setFilePath2(const std::basic_string<char>& path) {
130+
bool AuditLog::setFilePath2(std::string_view path) {
131131
this->m_path2 = path;
132132
return true;
133133
}
134134

135135

136-
bool AuditLog::setHeader(const std::basic_string<char>& header) {
136+
bool AuditLog::setHeader(std::string_view header) {
137137
this->m_header = header;
138138
return true;
139139
}
@@ -144,7 +144,7 @@ bool AuditLog::setFormat(AuditLogFormat fmt) {
144144
return true;
145145
}
146146

147-
int AuditLog::addParts(int parts, const std::string& new_parts) {
147+
int AuditLog::addParts(int parts, std::string_view new_parts) {
148148
PARTS_CONSTAINS('A', AAuditLogPart)
149149
PARTS_CONSTAINS('B', BAuditLogPart)
150150
PARTS_CONSTAINS('C', CAuditLogPart)
@@ -162,7 +162,7 @@ int AuditLog::addParts(int parts, const std::string& new_parts) {
162162
}
163163

164164

165-
int AuditLog::removeParts(int parts, const std::string& new_parts) {
165+
int AuditLog::removeParts(int parts, std::string_view new_parts) {
166166
PARTS_CONSTAINS_REM('A', AAuditLogPart)
167167
PARTS_CONSTAINS_REM('B', BAuditLogPart)
168168
PARTS_CONSTAINS_REM('C', CAuditLogPart)
@@ -180,7 +180,7 @@ int AuditLog::removeParts(int parts, const std::string& new_parts) {
180180
}
181181

182182

183-
bool AuditLog::setParts(const std::basic_string<char>& new_parts) {
183+
bool AuditLog::setParts(std::string_view new_parts) {
184184
int parts = 0;
185185

186186
PARTS_CONSTAINS('A', AAuditLogPart)

0 commit comments

Comments
 (0)