From: Victor Julien Date: Wed, 27 Apr 2022 15:28:14 +0000 (+0200) Subject: util/byte: minor cleanup X-Git-Tag: suricata-7.0.0-beta1~612 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d484d0b45b8e045b8fee7968724fdc708340d99f;p=thirdparty%2Fsuricata.git util/byte: minor cleanup --- diff --git a/src/util-byte.h b/src/util-byte.h index 5aa414d625..ce7133333e 100644 --- a/src/util-byte.h +++ b/src/util-byte.h @@ -477,9 +477,6 @@ void ByteRegisterTests(void); /** ------ Inline functions ----- */ static inline int ByteExtract(uint64_t *res, int e, uint16_t len, const uint8_t *bytes) { - uint64_t b = 0; - int i; - if ((e != BYTE_BIG_ENDIAN) && (e != BYTE_LITTLE_ENDIAN)) { /** \todo Need standard return values */ return -1; @@ -489,8 +486,8 @@ static inline int ByteExtract(uint64_t *res, int e, uint16_t len, const uint8_t /* Go through each byte and merge it into the result in the correct order */ /** \todo Probably a more efficient way to do this. */ - for (i = 0; i < len; i++) { - + for (int i = 0; i < len; i++) { + uint64_t b; if (e == BYTE_LITTLE_ENDIAN) { b = bytes[i]; } @@ -499,12 +496,9 @@ static inline int ByteExtract(uint64_t *res, int e, uint16_t len, const uint8_t } *res |= (b << ((i & 7) << 3)); - } return len; } - #endif /* __UTIL_BYTE_H__ */ -