]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/address: minor cleanup
authorVictor Julien <vjulien@oisf.net>
Sun, 31 Dec 2023 09:17:38 +0000 (10:17 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Jan 2024 19:23:28 +0000 (20:23 +0100)
src/detect-parse.c

index c259fd36f943a314c22e53953c82416825e54c43..a656d570cd3f12c357ed3c151a2c47dc72391e3f 100644 (file)
@@ -1797,8 +1797,8 @@ static void SigBuildAddressMatchArray(Signature *s)
     /* source addresses */
     uint16_t cnt = 0;
     uint16_t idx = 0;
-    DetectAddress *da = s->init_data->src->ipv4_head;
-    for ( ; da != NULL; da = da->next) {
+
+    for (const DetectAddress *da = s->init_data->src->ipv4_head; da != NULL; da = da->next) {
         cnt++;
     }
     if (cnt > 0) {
@@ -1807,7 +1807,7 @@ static void SigBuildAddressMatchArray(Signature *s)
             exit(EXIT_FAILURE);
         }
 
-        for (da = s->init_data->src->ipv4_head; da != NULL; da = da->next) {
+        for (const DetectAddress *da = s->init_data->src->ipv4_head; da != NULL; da = da->next) {
             s->addr_src_match4[idx].ip = SCNtohl(da->ip.addr_data32[0]);
             s->addr_src_match4[idx].ip2 = SCNtohl(da->ip2.addr_data32[0]);
             idx++;
@@ -1818,8 +1818,7 @@ static void SigBuildAddressMatchArray(Signature *s)
     /* destination addresses */
     cnt = 0;
     idx = 0;
-    da = s->init_data->dst->ipv4_head;
-    for ( ; da != NULL; da = da->next) {
+    for (const DetectAddress *da = s->init_data->dst->ipv4_head; da != NULL; da = da->next) {
         cnt++;
     }
     if (cnt > 0) {
@@ -1828,7 +1827,7 @@ static void SigBuildAddressMatchArray(Signature *s)
             exit(EXIT_FAILURE);
         }
 
-        for (da = s->init_data->dst->ipv4_head; da != NULL; da = da->next) {
+        for (const DetectAddress *da = s->init_data->dst->ipv4_head; da != NULL; da = da->next) {
             s->addr_dst_match4[idx].ip = SCNtohl(da->ip.addr_data32[0]);
             s->addr_dst_match4[idx].ip2 = SCNtohl(da->ip2.addr_data32[0]);
             idx++;
@@ -1839,8 +1838,7 @@ static void SigBuildAddressMatchArray(Signature *s)
     /* source addresses IPv6 */
     cnt = 0;
     idx = 0;
-    da = s->init_data->src->ipv6_head;
-    for ( ; da != NULL; da = da->next) {
+    for (const DetectAddress *da = s->init_data->src->ipv6_head; da != NULL; da = da->next) {
         cnt++;
     }
     if (cnt > 0) {
@@ -1849,7 +1847,7 @@ static void SigBuildAddressMatchArray(Signature *s)
             exit(EXIT_FAILURE);
         }
 
-        for (da = s->init_data->src->ipv6_head; da != NULL; da = da->next) {
+        for (const DetectAddress *da = s->init_data->src->ipv6_head; da != NULL; da = da->next) {
             s->addr_src_match6[idx].ip[0] = SCNtohl(da->ip.addr_data32[0]);
             s->addr_src_match6[idx].ip[1] = SCNtohl(da->ip.addr_data32[1]);
             s->addr_src_match6[idx].ip[2] = SCNtohl(da->ip.addr_data32[2]);
@@ -1866,8 +1864,7 @@ static void SigBuildAddressMatchArray(Signature *s)
     /* destination addresses IPv6 */
     cnt = 0;
     idx = 0;
-    da = s->init_data->dst->ipv6_head;
-    for ( ; da != NULL; da = da->next) {
+    for (const DetectAddress *da = s->init_data->dst->ipv6_head; da != NULL; da = da->next) {
         cnt++;
     }
     if (cnt > 0) {
@@ -1876,7 +1873,7 @@ static void SigBuildAddressMatchArray(Signature *s)
             exit(EXIT_FAILURE);
         }
 
-        for (da = s->init_data->dst->ipv6_head; da != NULL; da = da->next) {
+        for (const DetectAddress *da = s->init_data->dst->ipv6_head; da != NULL; da = da->next) {
             s->addr_dst_match6[idx].ip[0] = SCNtohl(da->ip.addr_data32[0]);
             s->addr_dst_match6[idx].ip[1] = SCNtohl(da->ip.addr_data32[1]);
             s->addr_dst_match6[idx].ip[2] = SCNtohl(da->ip.addr_data32[2]);