]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/build: minor code cleanup
authorVictor Julien <vjulien@oisf.net>
Mon, 13 Jun 2022 05:44:41 +0000 (07:44 +0200)
committerVictor Julien <vjulien@oisf.net>
Tue, 20 Sep 2022 12:55:24 +0000 (14:55 +0200)
src/detect-engine-build.c

index 5458ec4a26bb1794411338e27b6757344626270a..4d92565577c9ef3949df0613d5c7f2b698bb1444 100644 (file)
@@ -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;
                     }
                 }
             }