From: Victor Julien Date: Mon, 13 Jun 2022 05:44:41 +0000 (+0200) Subject: detect/build: minor code cleanup X-Git-Tag: suricata-7.0.0-beta1~221 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d941703cd82483a9e1a6ab4353926d1ae1384bb2;p=thirdparty%2Fsuricata.git detect/build: minor code cleanup --- diff --git a/src/detect-engine-build.c b/src/detect-engine-build.c index 5458ec4a26..4d92565577 100644 --- a/src/detect-engine-build.c +++ b/src/detect-engine-build.c @@ -1442,29 +1442,25 @@ int SigAddressPrepareStage1(DetectEngineCtx *de_ctx) /* get the keyword supporting prefilter with the lowest type */ for (int i = 0; i < (int)s->init_data->smlists_array_size; i++) { - SigMatch *sm = s->init_data->smlists[i]; - while (sm != NULL) { + for (SigMatch *sm = s->init_data->smlists[i]; sm != NULL; sm = sm->next) { if (sigmatch_table[sm->type].SupportsPrefilter != NULL) { if (sigmatch_table[sm->type].SupportsPrefilter(s)) { prefilter_list = MIN(prefilter_list, sm->type); } } - sm = sm->next; } } /* apply that keyword as prefilter */ if (prefilter_list != DETECT_TBLSIZE) { for (int i = 0; i < (int)s->init_data->smlists_array_size; i++) { - SigMatch *sm = s->init_data->smlists[i]; - while (sm != NULL) { + for (SigMatch *sm = s->init_data->smlists[i]; sm != NULL; sm = sm->next) { if (sm->type == prefilter_list) { s->init_data->prefilter_sm = sm; s->flags |= SIG_FLAG_PREFILTER; SCLogConfig("sid %u: prefilter is on \"%s\"", s->id, sigmatch_table[sm->type].name); break; } - sm = sm->next; } } }