app-layer: cleanups

Clean up AppLayerParserThreadCtxAlloc and AppLayerParserThreadCtxFree.
Both used confusing variables in loops, with the wrong types.
pull/914/merge
Victor Julien 11 years ago
parent 7e268bd4d4
commit 552558894c

@ -189,8 +189,8 @@ AppLayerParserThreadCtx *AppLayerParserThreadCtxAlloc(void)
{ {
SCEnter(); SCEnter();
AppProto i = 0; AppProto alproto = 0;
int j = 0; int flow_proto = 0;
AppLayerParserThreadCtx *tctx; AppLayerParserThreadCtx *tctx;
tctx = SCMalloc(sizeof(*tctx)); tctx = SCMalloc(sizeof(*tctx));
@ -198,10 +198,12 @@ AppLayerParserThreadCtx *AppLayerParserThreadCtxAlloc(void)
goto end; goto end;
memset(tctx, 0, sizeof(*tctx)); memset(tctx, 0, sizeof(*tctx));
for (i = 0; i < FLOW_PROTO_DEFAULT; i++) { for (flow_proto = 0; flow_proto < FLOW_PROTO_DEFAULT; flow_proto++) {
for (j = 0; j < ALPROTO_MAX; j++) { for (alproto = 0; alproto < ALPROTO_MAX; alproto++) {
tctx->alproto_local_storage[i][j] = uint8_t ipproto = FlowGetReverseProtoMapping(flow_proto);
AppLayerParserGetProtocolParserLocalStorage(FlowGetReverseProtoMapping(i), j);
tctx->alproto_local_storage[flow_proto][alproto] =
AppLayerParserGetProtocolParserLocalStorage(ipproto, alproto);
} }
} }
@ -213,14 +215,15 @@ void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx)
{ {
SCEnter(); SCEnter();
AppProto i = 0; AppProto alproto = 0;
int j = 0; int flow_proto = 0;
for (flow_proto = 0; flow_proto < FLOW_PROTO_DEFAULT; flow_proto++) {
for (alproto = 0; alproto < ALPROTO_MAX; alproto++) {
uint8_t ipproto = FlowGetReverseProtoMapping(flow_proto);
for (i = 0; i < FLOW_PROTO_DEFAULT; i++) { AppLayerParserDestroyProtocolParserLocalStorage(ipproto, alproto,
for (j = 0; j < ALPROTO_MAX; j++) { tctx->alproto_local_storage[flow_proto][alproto]);
AppLayerParserDestroyProtocolParserLocalStorage(FlowGetReverseProtoMapping(i),
j,
tctx->alproto_local_storage[i][j]);
} }
} }

Loading…
Cancel
Save