Speed up appending of sigs to a sig group head by using a tail ptr.

remotes/origin/master-1.0.x
Victor Julien 17 years ago
parent 0726efead9
commit b50fc8aecd

@ -81,14 +81,11 @@ int SigGroupAppend(DetectAddressGroup *ag, Signature *s) {
if (ag->sh->head == NULL) { if (ag->sh->head == NULL) {
/* put it as first in the list */ /* put it as first in the list */
ag->sh->head = sg; ag->sh->head = sg;
ag->sh->tail = sg;
} else { } else {
/* append to the list */ /* append to the list */
tmp_sg = ag->sh->head; tmp_sg = ag->sh->tail;
while (tmp_sg->next != NULL) { ag->sh->tail = tmp_sg->next = sg;
tmp_sg = tmp_sg->next;
}
tmp_sg->next = sg;
} }
ag->sh->sig_cnt++; ag->sh->sig_cnt++;
return 0; return 0;

@ -109,6 +109,7 @@ typedef struct _SigGroupHead {
/* list of signature containers */ /* list of signature containers */
SigGroupContainer *head; SigGroupContainer *head;
SigGroupContainer *tail;
u_int32_t sig_cnt; u_int32_t sig_cnt;
u_int32_t refcnt; u_int32_t refcnt;
@ -138,9 +139,9 @@ enum {
DETECT_METADATA, DETECT_METADATA,
DETECT_REFERENCE, DETECT_REFERENCE,
DETECT_MSG, DETECT_MSG,
DETECT_CONTENT, DETECT_CONTENT, /* 8 */
DETECT_URICONTENT, DETECT_URICONTENT, /* 9 */
DETECT_PCRE, DETECT_PCRE, /* 10 */
DETECT_DEPTH, DETECT_DEPTH,
DETECT_DISTANCE, DETECT_DISTANCE,
DETECT_WITHIN, DETECT_WITHIN,

Loading…
Cancel
Save