From b50fc8aecdedee3054f027ea5bb0b919c3829da0 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 25 Aug 2008 00:50:57 +0200 Subject: [PATCH] Speed up appending of sigs to a sig group head by using a tail ptr. --- src/detect-siggroup.c | 9 +++------ src/detect.h | 7 ++++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/detect-siggroup.c b/src/detect-siggroup.c index 3415f68bed..149d0ef6e8 100644 --- a/src/detect-siggroup.c +++ b/src/detect-siggroup.c @@ -81,14 +81,11 @@ int SigGroupAppend(DetectAddressGroup *ag, Signature *s) { if (ag->sh->head == NULL) { /* put it as first in the list */ ag->sh->head = sg; + ag->sh->tail = sg; } else { /* append to the list */ - tmp_sg = ag->sh->head; - while (tmp_sg->next != NULL) { - tmp_sg = tmp_sg->next; - } - - tmp_sg->next = sg; + tmp_sg = ag->sh->tail; + ag->sh->tail = tmp_sg->next = sg; } ag->sh->sig_cnt++; return 0; diff --git a/src/detect.h b/src/detect.h index 9872b6ebe0..8cd8b70bbb 100644 --- a/src/detect.h +++ b/src/detect.h @@ -109,6 +109,7 @@ typedef struct _SigGroupHead { /* list of signature containers */ SigGroupContainer *head; + SigGroupContainer *tail; u_int32_t sig_cnt; u_int32_t refcnt; @@ -138,9 +139,9 @@ enum { DETECT_METADATA, DETECT_REFERENCE, DETECT_MSG, - DETECT_CONTENT, - DETECT_URICONTENT, - DETECT_PCRE, + DETECT_CONTENT, /* 8 */ + DETECT_URICONTENT, /* 9 */ + DETECT_PCRE, /* 10 */ DETECT_DEPTH, DETECT_DISTANCE, DETECT_WITHIN,