From: Victor Julien Date: Sun, 8 Oct 2017 16:23:22 +0000 (+0200) Subject: app-layer: use bool for 'HasDecoderEvents' X-Git-Tag: suricata-4.1.0-beta1~416 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=948dee9a981c53f5dc5f36fd671626a8364f43b0;p=thirdparty%2Fsuricata.git app-layer: use bool for 'HasDecoderEvents' --- diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index cc1b82536c..3e5ba2436a 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -1130,9 +1130,9 @@ void AppLayerParserSetEOF(AppLayerParserState *pstate) SCReturn; } -int AppLayerParserHasDecoderEvents(const Flow *f, - void *alstate, AppLayerParserState *pstate, - uint8_t flags) +bool AppLayerParserHasDecoderEvents(const Flow *f, + void *alstate, AppLayerParserState *pstate, + const uint8_t flags) { SCEnter(); @@ -1169,9 +1169,9 @@ int AppLayerParserHasDecoderEvents(const Flow *f, /* if we have reached here, we don't have events */ not_present: - SCReturnInt(0); + return false; present: - SCReturnInt(1); + return true; } /** \brief simpler way to globally test if a alproto is registered diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index efaa02c87a..29a7df70ca 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -218,8 +218,8 @@ int AppLayerParserSetTxMpmIDs(uint8_t ipproto, AppProto alproto, void *tx, uint6 int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *tctx, Flow *f, AppProto alproto, uint8_t flags, uint8_t *input, uint32_t input_len); void AppLayerParserSetEOF(AppLayerParserState *pstate); -int AppLayerParserHasDecoderEvents(const Flow *f, void *alstate, AppLayerParserState *pstate, - uint8_t flags); +bool AppLayerParserHasDecoderEvents(const Flow *f, void *alstate, AppLayerParserState *pstate, + const uint8_t flags); int AppLayerParserIsTxAware(AppProto alproto); int AppLayerParserProtocolIsTxAware(uint8_t ipproto, AppProto alproto); int AppLayerParserProtocolIsTxEventAware(uint8_t ipproto, AppProto alproto); diff --git a/src/detect-engine-build.c b/src/detect-engine-build.c index 15f3c6fbd7..d3e7bc40aa 100644 --- a/src/detect-engine-build.c +++ b/src/detect-engine-build.c @@ -403,7 +403,7 @@ deonly: */ void PacketCreateMask(Packet *p, SignatureMask *mask, AppProto alproto, - bool has_state, int app_decoder_events) + bool has_state, bool app_decoder_events) { if (!(p->flags & PKT_NOPAYLOAD_INSPECTION) && p->payload_len > 0) { SCLogDebug("packet has payload"); diff --git a/src/detect-engine-build.h b/src/detect-engine-build.h index 7eb41d760b..25322f6410 100644 --- a/src/detect-engine-build.h +++ b/src/detect-engine-build.h @@ -19,7 +19,7 @@ #define __DETECT_ENGINE_BUILD_H__ void PacketCreateMask(Packet *p, SignatureMask *mask, AppProto alproto, - bool has_state, int app_decoder_events); + bool has_state, bool app_decoder_events); int SignatureIsFilestoring(const Signature *); int SignatureIsFilemagicInspecting(const Signature *); diff --git a/src/detect.c b/src/detect.c index 0e16ca2fb7..8c05622112 100644 --- a/src/detect.c +++ b/src/detect.c @@ -418,7 +418,7 @@ void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineT const Signature *s = NULL; const Signature *next_s = NULL; int state_alert = 0; - int app_decoder_events = 0; + bool app_decoder_events = false; bool has_state = false; /* do we have an alstate to work with? */ SCEnter();