]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/content-inspect: use of replace keyword is rare
authorVictor Julien <vjulien@oisf.net>
Sun, 17 Dec 2023 17:02:35 +0000 (18:02 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Jan 2024 19:23:28 +0000 (20:23 +0100)
Hint compiler about this.

src/detect-engine-content-inspection.c

index 81f2e30f31a6b942e30c6123d6a57f12c7326978..b204d1edaa7e9c5506406850b722a95ac0855c68 100644 (file)
@@ -337,7 +337,7 @@ static int DetectEngineContentInspectionInternal(DetectEngineThreadCtx *det_ctx,
 
             if ((cd->flags & DETECT_CONTENT_ENDS_WITH) == 0 || match_offset == buffer_len) {
                 /* Match branch, add replace to the list if needed */
-                if (cd->flags & DETECT_CONTENT_REPLACE) {
+                if (unlikely(cd->flags & DETECT_CONTENT_REPLACE)) {
                     if (inspection_mode == DETECT_ENGINE_CONTENT_INSPECTION_MODE_PAYLOAD) {
                         /* we will need to replace content if match is confirmed
                          * cast to non-const as replace writes to it. */