]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util/byte: minor cleanup
authorVictor Julien <vjulien@oisf.net>
Wed, 27 Apr 2022 15:28:14 +0000 (17:28 +0200)
committerVictor Julien <vjulien@oisf.net>
Mon, 9 May 2022 14:06:40 +0000 (16:06 +0200)
src/util-byte.h

index 5aa414d6250d5ce627fba5b5aa03edc711ee3778..ce7133333e672d20c279888c1d7a509620557c79 100644 (file)
@@ -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__ */
-