From 57d77921bbd21ca830a14acd8ad222495d3eeb6a Mon Sep 17 00:00:00 2001 From: Rose Silicon Date: Sat, 31 Aug 2024 23:03:24 -0400 Subject: [PATCH] Prefer a != b over !(a == b) (#2303) This is not C++ or another language where this may have been necessary, nor is the condition complex at all; it is only a single equality comparison. --- libarchive/archive_read_support_format_rar.c | 3 +-- libarchive/archive_write_set_format_gnutar.c | 2 +- libarchive/archive_write_set_format_ustar.c | 2 +- libarchive/archive_write_set_format_v7tar.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c index e041ff765..cbc6ec984 100644 --- a/libarchive/archive_read_support_format_rar.c +++ b/libarchive/archive_read_support_format_rar.c @@ -2607,8 +2607,7 @@ read_next_symbol(struct archive_read *a, struct huffman_code *code) rar_br_consume(br, code->tablesize); node = value; - while (!(code->tree[node].branches[0] == - code->tree[node].branches[1])) + while (code->tree[node].branches[0] != code->tree[node].branches[1]) { if (!rar_br_read_ahead(a, br, 1)) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, diff --git a/libarchive/archive_write_set_format_gnutar.c b/libarchive/archive_write_set_format_gnutar.c index a3a49c573..8979078ee 100644 --- a/libarchive/archive_write_set_format_gnutar.c +++ b/libarchive/archive_write_set_format_gnutar.c @@ -296,7 +296,7 @@ archive_write_gnutar_header(struct archive_write *a, /* Only regular files (not hardlinks) have data. */ if (archive_entry_hardlink(entry) != NULL || archive_entry_symlink(entry) != NULL || - !(archive_entry_filetype(entry) == AE_IFREG)) + archive_entry_filetype(entry) != AE_IFREG) archive_entry_set_size(entry, 0); if (AE_IFDIR == archive_entry_filetype(entry)) { diff --git a/libarchive/archive_write_set_format_ustar.c b/libarchive/archive_write_set_format_ustar.c index d8f0b4584..9dc6e71f1 100644 --- a/libarchive/archive_write_set_format_ustar.c +++ b/libarchive/archive_write_set_format_ustar.c @@ -267,7 +267,7 @@ archive_write_ustar_header(struct archive_write *a, struct archive_entry *entry) /* Only regular files (not hardlinks) have data. */ if (archive_entry_hardlink(entry) != NULL || archive_entry_symlink(entry) != NULL || - !(archive_entry_filetype(entry) == AE_IFREG)) + archive_entry_filetype(entry) != AE_IFREG) archive_entry_set_size(entry, 0); if (AE_IFDIR == archive_entry_filetype(entry)) { diff --git a/libarchive/archive_write_set_format_v7tar.c b/libarchive/archive_write_set_format_v7tar.c index e3724a096..ffb420f08 100644 --- a/libarchive/archive_write_set_format_v7tar.c +++ b/libarchive/archive_write_set_format_v7tar.c @@ -241,7 +241,7 @@ archive_write_v7tar_header(struct archive_write *a, struct archive_entry *entry) /* Only regular files (not hardlinks) have data. */ if (archive_entry_hardlink(entry) != NULL || archive_entry_symlink(entry) != NULL || - !(archive_entry_filetype(entry) == AE_IFREG)) + archive_entry_filetype(entry) != AE_IFREG) archive_entry_set_size(entry, 0); if (AE_IFDIR == archive_entry_filetype(entry)) { -- 2.47.2