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) {
/* 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;

@ -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,

Loading…
Cancel
Save