Skip to content

Commit 57d7792

Browse files
authored
Prefer a != b over !(a == b) (libarchive#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.
1 parent 8137ba1 commit 57d7792

4 files changed

+4
-5
lines changed

libarchive/archive_read_support_format_rar.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -2607,8 +2607,7 @@ read_next_symbol(struct archive_read *a, struct huffman_code *code)
26072607
rar_br_consume(br, code->tablesize);
26082608

26092609
node = value;
2610-
while (!(code->tree[node].branches[0] ==
2611-
code->tree[node].branches[1]))
2610+
while (code->tree[node].branches[0] != code->tree[node].branches[1])
26122611
{
26132612
if (!rar_br_read_ahead(a, br, 1)) {
26142613
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,

libarchive/archive_write_set_format_gnutar.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ archive_write_gnutar_header(struct archive_write *a,
296296
/* Only regular files (not hardlinks) have data. */
297297
if (archive_entry_hardlink(entry) != NULL ||
298298
archive_entry_symlink(entry) != NULL ||
299-
!(archive_entry_filetype(entry) == AE_IFREG))
299+
archive_entry_filetype(entry) != AE_IFREG)
300300
archive_entry_set_size(entry, 0);
301301

302302
if (AE_IFDIR == archive_entry_filetype(entry)) {

libarchive/archive_write_set_format_ustar.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ archive_write_ustar_header(struct archive_write *a, struct archive_entry *entry)
267267
/* Only regular files (not hardlinks) have data. */
268268
if (archive_entry_hardlink(entry) != NULL ||
269269
archive_entry_symlink(entry) != NULL ||
270-
!(archive_entry_filetype(entry) == AE_IFREG))
270+
archive_entry_filetype(entry) != AE_IFREG)
271271
archive_entry_set_size(entry, 0);
272272

273273
if (AE_IFDIR == archive_entry_filetype(entry)) {

libarchive/archive_write_set_format_v7tar.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ archive_write_v7tar_header(struct archive_write *a, struct archive_entry *entry)
241241
/* Only regular files (not hardlinks) have data. */
242242
if (archive_entry_hardlink(entry) != NULL ||
243243
archive_entry_symlink(entry) != NULL ||
244-
!(archive_entry_filetype(entry) == AE_IFREG))
244+
archive_entry_filetype(entry) != AE_IFREG)
245245
archive_entry_set_size(entry, 0);
246246

247247
if (AE_IFDIR == archive_entry_filetype(entry)) {

0 commit comments

Comments
 (0)