]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: remove unneeded else
authorShivani Bhardwaj <shivani@oisf.net>
Sat, 15 Mar 2025 09:38:51 +0000 (15:08 +0530)
committerVictor Julien <victor@inliniac.net>
Sat, 29 Mar 2025 05:37:59 +0000 (06:37 +0100)
src/stream-tcp-reassemble.c

index 7752f14e5e11e0f6ce6499d0b174444239ee20f5..18d3dd2c8bf94431d769a3611c4ac2390613872e 100644 (file)
@@ -409,9 +409,8 @@ static inline uint64_t GetAbsLastAck(const TcpStream *stream)
 {
     if (STREAM_LASTACK_GT_BASESEQ(stream)) {
         return STREAM_BASE_OFFSET(stream) + (stream->last_ack - stream->base_seq);
-    } else {
-        return STREAM_BASE_OFFSET(stream);
     }
+    return STREAM_BASE_OFFSET(stream);
 }
 
 // may contain gaps
@@ -727,11 +726,11 @@ uint32_t StreamDataAvailableForProtoDetect(TcpStream *stream)
             return 0;
 
         return stream->sb.region.buf_offset;
-    } else {
-        DEBUG_VALIDATE_BUG_ON(stream->sb.head == NULL);
-        DEBUG_VALIDATE_BUG_ON(stream->sb.sbb_size == 0);
-        return stream->sb.sbb_size;
     }
+
+    DEBUG_VALIDATE_BUG_ON(stream->sb.head == NULL);
+    DEBUG_VALIDATE_BUG_ON(stream->sb.sbb_size == 0);
+    return stream->sb.sbb_size;
 }
 
 /**
@@ -1201,17 +1200,16 @@ static inline bool CheckGap(TcpSession *ssn, TcpStream *stream, Packet *p)
                            "next_seq %u < last_ack %u, but no data in list",
                         p->pcap_cnt, stream->next_seq, stream->last_ack);
                 return false;
-            } else {
-                const uint64_t next_seq_abs =
-                        STREAM_BASE_OFFSET(stream) + (stream->next_seq - stream->base_seq);
-                const StreamingBufferBlock *blk = stream->sb.head;
-                if (blk->offset > next_seq_abs && blk->offset < last_ack_abs) {
-                    /* ack'd data after the gap */
-                    SCLogDebug("packet %" PRIu64 ": GAP. "
-                               "next_seq %u < last_ack %u, but ACK'd data beyond gap.",
-                            p->pcap_cnt, stream->next_seq, stream->last_ack);
-                    return true;
-                }
+            }
+            const uint64_t next_seq_abs =
+                    STREAM_BASE_OFFSET(stream) + (stream->next_seq - stream->base_seq);
+            const StreamingBufferBlock *blk = stream->sb.head;
+            if (blk->offset > next_seq_abs && blk->offset < last_ack_abs) {
+                /* ack'd data after the gap */
+                SCLogDebug("packet %" PRIu64 ": GAP. "
+                           "next_seq %u < last_ack %u, but ACK'd data beyond gap.",
+                        p->pcap_cnt, stream->next_seq, stream->last_ack);
+                return true;
             }
         }