app-layer: micro optimization for AppProtoEquals

Add most common condition first.
pull/10134/head
Victor Julien 2 years ago committed by Victor Julien
parent 88cc999184
commit fd4ca53eb7

@ -87,14 +87,16 @@ static inline bool AppProtoIsValid(AppProto a)
// whether a signature AppProto matches a flow (or signature) AppProto // whether a signature AppProto matches a flow (or signature) AppProto
static inline bool AppProtoEquals(AppProto sigproto, AppProto alproto) static inline bool AppProtoEquals(AppProto sigproto, AppProto alproto)
{ {
if (sigproto == alproto) {
return true;
}
switch (sigproto) { switch (sigproto) {
case ALPROTO_HTTP: case ALPROTO_HTTP:
return (alproto == ALPROTO_HTTP1) || (alproto == ALPROTO_HTTP2) || return (alproto == ALPROTO_HTTP1) || (alproto == ALPROTO_HTTP2);
(alproto == ALPROTO_HTTP);
case ALPROTO_DCERPC: case ALPROTO_DCERPC:
return (alproto == ALPROTO_DCERPC || alproto == ALPROTO_SMB); return (alproto == ALPROTO_SMB);
} }
return (sigproto == alproto); return false;
} }
/** /**

Loading…
Cancel
Save