From abc44fe98a44e5ea55471700b82fa86396daeb24 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 10 Aug 2016 16:36:14 -0500 Subject: [PATCH] eapol: Use switch-case instead of if The if statement was shorter, but a bit less readable. --- src/eapol.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/eapol.c b/src/eapol.c index b45301bd..e9223af2 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -202,10 +202,13 @@ const struct eapol_key *eapol_key_validate(const uint8_t *frame, size_t len) ek = (const struct eapol_key *) frame; - if (ek->header.protocol_version != EAPOL_PROTOCOL_VERSION_2001 && - ek->header.protocol_version != - EAPOL_PROTOCOL_VERSION_2004) + switch (ek->header.protocol_version) { + case EAPOL_PROTOCOL_VERSION_2001: + case EAPOL_PROTOCOL_VERSION_2004: + break; + default: return NULL; + } if (ek->header.packet_type != 3) return NULL;