From dd7e710f3578cfc06be8199c67761573de84535b Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Sat, 18 Feb 2012 17:39:01 +0530 Subject: [PATCH] code cleanup - replace SigMatchAppendPostMatch with SigMatchAppendSMToList --- src/detect-flowbits.c | 2 +- src/detect-flowint.c | 2 +- src/detect-parse.c | 26 -------------------------- src/detect-parse.h | 1 - 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/detect-flowbits.c b/src/detect-flowbits.c index 762fc5fb0b..38dc6186e4 100644 --- a/src/detect-flowbits.c +++ b/src/detect-flowbits.c @@ -264,7 +264,7 @@ int DetectFlowbitSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawstr) case DETECT_FLOWBITS_CMD_UNSET: case DETECT_FLOWBITS_CMD_TOGGLE: /* modifiers, only run when entire sig has matched */ - SigMatchAppendPostMatch(s, sm); + SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_POSTMATCH); break; } diff --git a/src/detect-flowint.c b/src/detect-flowint.c index 508bce52b8..c7802fc302 100644 --- a/src/detect-flowint.c +++ b/src/detect-flowint.c @@ -379,7 +379,7 @@ static int DetectFlowintSetup(DetectEngineCtx *de_ctx, Signature *s, char *rawst case FLOWINT_MODIFIER_SET: case FLOWINT_MODIFIER_ADD: case FLOWINT_MODIFIER_SUB: - SigMatchAppendPostMatch(s, sm); + SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_POSTMATCH); break; case FLOWINT_MODIFIER_LT: diff --git a/src/detect-parse.c b/src/detect-parse.c index 77559f0cbc..25f16d1b54 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -198,32 +198,6 @@ void SigMatchAppendThreshold(Signature *s, SigMatch *new) { SigMatchAppendSMToList(s, new, DETECT_SM_LIST_THRESHOLD); } -/** \brief Append a sig match to the signatures post-match list - * - * \param s signature - * \param new sigmatch to append - */ -void SigMatchAppendPostMatch(Signature *s, SigMatch *new) { - if (s->sm_lists[DETECT_SM_LIST_POSTMATCH] == NULL) { - s->sm_lists[DETECT_SM_LIST_POSTMATCH] = new; - s->sm_lists_tail[DETECT_SM_LIST_POSTMATCH] = new; - new->next = NULL; - new->prev = NULL; - } else { - SigMatch *cur = s->sm_lists[DETECT_SM_LIST_POSTMATCH]; - - for ( ; cur->next != NULL; cur = cur->next); - - cur->next = new; - new->next = NULL; - new->prev = cur; - s->sm_lists_tail[DETECT_SM_LIST_POSTMATCH] = new; - } - - new->idx = s->sm_cnt; - s->sm_cnt++; -} - /** \brief Pull a content 'old' from the pmatch list, append 'new' to amatch list. * Used for replacing contents that have http_cookie, etc modifiers. */ diff --git a/src/detect-parse.h b/src/detect-parse.h index 43b9e1b163..2b8e63ab94 100644 --- a/src/detect-parse.h +++ b/src/detect-parse.h @@ -58,7 +58,6 @@ void SigMatchReplaceContent(Signature *, SigMatch *, SigMatch *); void SigMatchReplaceContentToUricontent(Signature *, SigMatch *, SigMatch *); void SigMatchAppendThreshold(Signature *, SigMatch *); -void SigMatchAppendPostMatch(Signature *, SigMatch *); void SigMatchAppendSMToList(Signature *, SigMatch *, int); void SigMatchRemoveSMFromList(Signature *, SigMatch *, int); int SigMatchListSMBelongsTo(Signature *, SigMatch *);