fs/ntfs3: Use swap() to improve code
authorThorsten Blum <thorsten.blum@toblux.com>
Wed, 31 Jul 2024 13:54:04 +0000 (15:54 +0200)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Tue, 3 Sep 2024 13:58:38 +0000 (16:58 +0300)
Use the swap() macro to simplify the code and improve its readability.

Fixes the following Coccinelle/coccicheck warning reported by
swap.cocci:

  WARNING opportunity for swap()

Compile-tested only.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/lib/lzx_decompress.c

index 6b16f07073c12cf349cfa1cfe6bcbf0168b38d28..4d5701024f8309ca18b498147e35c60321f65e46 100644 (file)
@@ -512,8 +512,7 @@ static int lzx_decompress_block(const struct lzx_decompressor *d,
                         * the same code.  (For R0, the swap is a no-op.)
                         */
                        match_offset = recent_offsets[offset_slot];
-                       recent_offsets[offset_slot] = recent_offsets[0];
-                       recent_offsets[0] = match_offset;
+                       swap(recent_offsets[offset_slot], recent_offsets[0]);
                } else {
                        /* Explicit offset  */