]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Prefer a != b over !(a == b) (#2303)
authorRose Silicon <gfunni234@gmail.com>
Sun, 1 Sep 2024 03:03:24 +0000 (23:03 -0400)
committerGitHub <noreply@github.com>
Sun, 1 Sep 2024 03:03:24 +0000 (20:03 -0700)
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
libarchive/archive_write_set_format_gnutar.c
libarchive/archive_write_set_format_ustar.c
libarchive/archive_write_set_format_v7tar.c

index e041ff765c0d3f69d54f892bac1d797a29d641c4..cbc6ec984068d62ef1e5d4acde69e9225dbe287c 100644 (file)
@@ -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,
index a3a49c573c64d44090bc895a3e483d689a181833..8979078ee4bb51cf5dff27c35d7a8360d03fb4e2 100644 (file)
@@ -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)) {
index d8f0b458462c0f57d22ee53f2617138b821d2747..9dc6e71f189f606a377be1c65144a5d2560c920f 100644 (file)
@@ -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)) {
index e3724a096da72107ae92b265c9c9d3006d028559..ffb420f08ba115deac84c66a862532bc8a9776b3 100644 (file)
@@ -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)) {