Skip to content

Commit 9c450d1

Browse files
committed
eve/drop: minor code cleanup
1 parent f9b25dc commit 9c450d1

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

src/output-json-drop.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,8 @@ static int DropLogJSON(ThreadVars *tv, JsonDropLogThread *aft, const Packet *p)
168168
}
169169

170170
if (aft->drop_ctx->flags & LOG_DROP_ALERTS) {
171-
int logged = 0;
172-
int i;
173-
for (i = 0; i < p->alerts.cnt; i++) {
171+
bool logged = false;
172+
for (int i = 0; i < p->alerts.cnt; i++) {
174173
const PacketAlert *pa = &p->alerts.alerts[i];
175174
if (unlikely(pa->s == NULL)) {
176175
continue;
@@ -179,15 +178,13 @@ static int DropLogJSON(ThreadVars *tv, JsonDropLogThread *aft, const Packet *p)
179178
((pa->action & ACTION_DROP) && EngineModeIsIPS()))
180179
{
181180
AlertJsonHeader(p, pa, js, 0, &addr, NULL);
182-
logged = 1;
181+
logged = true;
183182
break;
184183
}
185184
}
186-
if (logged == 0) {
187-
if (p->alerts.drop.action != 0) {
188-
const PacketAlert *pa = &p->alerts.drop;
189-
AlertJsonHeader(p, pa, js, 0, &addr, NULL);
190-
}
185+
if (!logged && p->alerts.drop.action != 0) {
186+
const PacketAlert *pa = &p->alerts.drop;
187+
AlertJsonHeader(p, pa, js, 0, &addr, NULL);
191188
}
192189
}
193190

0 commit comments

Comments
 (0)