code cleanup - replace SigMatchAppendPayload with SigMatchAppendSMToList

remotes/origin/master
Anoop Saldanha 14 years ago committed by Victor Julien
parent c4cb37b8da
commit 6cab663bf0

@ -619,7 +619,7 @@ int DetectByteExtractSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg)
} else if (dm == NULL) {
SigMatchAppendDcePayload(s, sm);
} else if (pm->idx > dm->idx) {
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
} else {
SigMatchAppendDcePayload(s, sm);
}
@ -651,9 +651,9 @@ int DetectByteExtractSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg)
if (list == DETECT_SM_LIST_UMATCH)
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_UMATCH);
else
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
} else {
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
}
}

@ -600,12 +600,12 @@ int DetectBytejumpSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr)
} else if (dm == NULL) {
SigMatchAppendDcePayload(s, sm);
} else if (pm->idx > dm->idx) {
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
} else {
SigMatchAppendDcePayload(s, sm);
}
} else {
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
}
if (offset != NULL) {

@ -524,12 +524,12 @@ int DetectBytetestSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr)
} else if (dm == NULL) {
SigMatchAppendDcePayload(s, sm);
} else if (pm->idx > dm->idx) {
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
} else {
SigMatchAppendDcePayload(s, sm);
}
} else {
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
}
if (value != NULL) {

@ -406,7 +406,7 @@ static int DetectContentSetup (DetectEngineCtx *de_ctx, Signature *s, char *cont
DetectContentPrint(cd);
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
if (s->init_flags & SIG_FLAG_INIT_FILE_DATA) {
cd->id = DetectPatternGetId(de_ctx->mpm_pattern_id_store, cd, DETECT_SM_LIST_HSBDMATCH);

@ -281,7 +281,7 @@ int DetectIsdataatSetup (DetectEngineCtx *de_ctx, Signature *s, char *isdataatst
} else if (dm == NULL) {
SigMatchAppendDcePayload(s, sm);
} else if (pm->idx > dm->idx) {
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
} else {
SigMatchAppendDcePayload(s, sm);
}
@ -334,7 +334,7 @@ int DetectIsdataatSetup (DetectEngineCtx *de_ctx, Signature *s, char *isdataatst
prev_pm = pm;
} else {
if (!(idad->flags & ISDATAAT_RELATIVE)) {
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
if (offset != NULL) {
SigMatch *bed_sm =
DetectByteExtractRetrieveSMVar(offset, s,

@ -173,24 +173,6 @@ void SigMatchAppendSMToList(Signature *s, SigMatch *new, int list)
s->sm_cnt++;
}
void SigMatchAppendPayload(Signature *s, SigMatch *new) {
if (s->sm_lists[DETECT_SM_LIST_PMATCH] == NULL) {
s->sm_lists[DETECT_SM_LIST_PMATCH] = new;
s->sm_lists_tail[DETECT_SM_LIST_PMATCH] = new;
new->next = NULL;
new->prev = NULL;
} else {
SigMatch *cur = s->sm_lists_tail[DETECT_SM_LIST_PMATCH];
cur->next = new;
new->prev = cur;
new->next = NULL;
s->sm_lists_tail[DETECT_SM_LIST_PMATCH] = new;
}
new->idx = s->sm_cnt;
s->sm_cnt++;
}
void SigMatchAppendDcePayload(Signature *s, SigMatch *new) {
SCLogDebug("Append SigMatch against s->sm_lists[DETECT_SM_LIST_DMATCH](dce) list");
if (s->sm_lists[DETECT_SM_LIST_DMATCH] == NULL) {

@ -57,7 +57,6 @@ void SigMatchReplace(Signature *, SigMatch *, SigMatch *);
void SigMatchReplaceContent(Signature *, SigMatch *, SigMatch *);
void SigMatchReplaceContentToUricontent(Signature *, SigMatch *, SigMatch *);
void SigMatchAppendPayload(Signature *, SigMatch *);
void SigMatchAppendDcePayload(Signature *, SigMatch *);
void SigMatchAppendPacket(Signature *, SigMatch *);
void SigMatchAppendThreshold(Signature *, SigMatch *);

@ -1180,7 +1180,7 @@ static int DetectPcreSetup (DetectEngineCtx *de_ctx, Signature *s, char *regexst
} else if (dm == NULL) {
SigMatchAppendDcePayload(s, sm);
} else if (pm->idx > dm->idx) {
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
} else {
SigMatchAppendDcePayload(s, sm);
}
@ -1192,7 +1192,7 @@ static int DetectPcreSetup (DetectEngineCtx *de_ctx, Signature *s, char *regexst
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_HSBDMATCH);
} else {
SigMatchAppendPayload(s, sm);
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_PMATCH);
}
}
}

Loading…
Cancel
Save