New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove redundant operations #1992
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a handful of unrelated changes that should be dropped from this patch. Nothing too special though.
libarchive/archive_read_open_fd.c
Outdated
|
||
if (!mine->use_lseek) | ||
return (0); | ||
|
||
/* Reduce a request that would overflow the 'skip' variable. */ | ||
if (sizeof(request) > sizeof(skip)) { | ||
int skip_bits = sizeof(skip) * 8 - 1; /* off_t is a signed type. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated change.
libarchive/archive_read_open_file.c
Outdated
@@ -145,6 +144,7 @@ file_skip(struct archive *a, void *client_data, int64_t request) | |||
|
|||
/* If request is too big for a long or an off_t, reduce it. */ | |||
if (sizeof(request) > sizeof(skip)) { | |||
int skip_bits = sizeof(skip) * 8 - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto - unrelated change.
d3f5935
to
52d2dcb
Compare
72033fc
to
d175908
Compare
#ifdef HAVE_ERRNO_H | ||
#include <errno.h> | ||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, please pay attention to previous suggestions. These should be separate patch (doesn't matter which MR), literally all MRs have bunch of unaddressed and unrelated whitespace changes.
Thanks o/
@@ -384,7 +384,7 @@ drive_compressor(struct archive_write_filter *f, | |||
struct private_data *data, int flush, const void *src, size_t length) | |||
{ | |||
ZSTD_inBuffer in = { .src = src, .size = length, .pos = 0 }; | |||
size_t ipos, opos, zstdret = 0; | |||
size_t ipos, opos, zstdret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to keep the = 0
here. It's not obvious by looking at only this function that data->state
cannot be resetting
on entry. (You would have to study every place that data->state
was set to be certain of this.
@@ -265,7 +265,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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace is wrong here.
@@ -243,7 +243,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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace is wrong here.
@@ -40,9 +40,6 @@ __FBSDID("$FreeBSD$"); | |||
#ifdef HAVE_STRING_H | |||
#include <string.h> | |||
#endif | |||
#ifdef HAVE_UNISTD_H | |||
#include <unistd.h> | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing headers must be done very carefully. Libarchive builds on a lot of different platforms, many of which have headers that behave quite differently. PLEASE make changes like this in a separate Pull Request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Emil: There are some good changes here, but some that really should be handled separately.
ceeca32
to
7e4ddae
Compare
Some operations, like assigning to 0, or breaking after a non-returning function, are redundant and can be removed.
7e4ddae
to
5ec8cd3
Compare
Some operations, like assigning to 0, or breaking after a non-returning function, are redundant and can be removed.