Skip to content

Commit

Permalink
[lldb] Fix redundant condition in compression type check (NFC) (#94841)
Browse files Browse the repository at this point in the history
The `else if` condition for checking `m_compression_type` is redundant
as it matches with a previous `if` condition, making the expression
always false. Reported by cppcheck as a possible cut-and-paste error.

Caught by cppcheck -

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:543:35:
style: Expression is always false because 'else if' condition matches
previous condition at line 535. [multiCondition]

Fix #91222
  • Loading branch information
xgupta authored Jun 10, 2024
1 parent 0257f9c commit 0af2e75
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,8 @@ bool GDBRemoteCommunication::DecompressPacket() {
else if (m_compression_type == CompressionType::ZlibDeflate)
scratchbuf_size = compression_decode_scratch_buffer_size (COMPRESSION_ZLIB);
else if (m_compression_type == CompressionType::LZMA)
scratchbuf_size = compression_decode_scratch_buffer_size (COMPRESSION_LZMA);
else if (m_compression_type == CompressionType::LZFSE)
scratchbuf_size = compression_decode_scratch_buffer_size (COMPRESSION_LZFSE);
scratchbuf_size =
compression_decode_scratch_buffer_size(COMPRESSION_LZMA);
if (scratchbuf_size > 0) {
m_decompression_scratch = (void*) malloc (scratchbuf_size);
m_decompression_scratch_type = m_compression_type;
Expand Down

0 comments on commit 0af2e75

Please sign in to comment.