Remove some unused fields from the private archive_read structure
(left over from when the unified read/write structure was copied to form separate read and write structures) and eliminate the pointless initialization of a couple of the unused fields.
This commit is contained in:
parent
c2247d3995
commit
0b4793efb7
@ -64,25 +64,12 @@ struct archive *
|
||||
archive_read_new(void)
|
||||
{
|
||||
struct archive_read *a;
|
||||
unsigned char *nulls;
|
||||
|
||||
a = (struct archive_read *)malloc(sizeof(*a));
|
||||
if (a == NULL)
|
||||
return (NULL);
|
||||
memset(a, 0, sizeof(*a));
|
||||
a->archive.magic = ARCHIVE_READ_MAGIC;
|
||||
a->bytes_per_block = ARCHIVE_DEFAULT_BYTES_PER_BLOCK;
|
||||
|
||||
a->null_length = 1024;
|
||||
nulls = (unsigned char *)malloc(a->null_length);
|
||||
if (nulls == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM,
|
||||
"Can't allocate archive object 'nulls' element");
|
||||
free(a);
|
||||
return (NULL);
|
||||
}
|
||||
memset(nulls, 0, a->null_length);
|
||||
a->nulls = nulls;
|
||||
|
||||
a->archive.state = ARCHIVE_STATE_NEW;
|
||||
a->entry = archive_entry_new();
|
||||
@ -660,8 +647,6 @@ archive_read_finish(struct archive *_a)
|
||||
(a->formats[i].cleanup)(a);
|
||||
}
|
||||
|
||||
/* Casting a pointer to int allows us to remove 'const.' */
|
||||
free((void *)(uintptr_t)(const void *)a->nulls);
|
||||
archive_string_free(&a->archive.error_string);
|
||||
if (a->entry)
|
||||
archive_entry_free(a->entry);
|
||||
|
@ -41,10 +41,6 @@ struct archive_read {
|
||||
dev_t skip_file_dev;
|
||||
ino_t skip_file_ino;
|
||||
|
||||
/* Utility: Pointer to a block of nulls. */
|
||||
const unsigned char *nulls;
|
||||
size_t null_length;
|
||||
|
||||
/*
|
||||
* Used by archive_read_data() to track blocks and copy
|
||||
* data to client buffers, filling gaps with zero bytes.
|
||||
@ -58,30 +54,9 @@ struct archive_read {
|
||||
archive_open_callback *client_opener;
|
||||
archive_read_callback *client_reader;
|
||||
archive_skip_callback *client_skipper;
|
||||
archive_write_callback *client_writer;
|
||||
archive_close_callback *client_closer;
|
||||
void *client_data;
|
||||
|
||||
/*
|
||||
* Blocking information. Note that bytes_in_last_block is
|
||||
* misleadingly named; I should find a better name. These
|
||||
* control the final output from all compressors, including
|
||||
* compression_none.
|
||||
*/
|
||||
int bytes_per_block;
|
||||
int bytes_in_last_block;
|
||||
|
||||
/*
|
||||
* These control whether data within a gzip/bzip2 compressed
|
||||
* stream gets padded or not. If pad_uncompressed is set,
|
||||
* the data will be padded to a full block before being
|
||||
* compressed. The pad_uncompressed_byte determines the value
|
||||
* that will be used for padding. Note that these have no
|
||||
* effect on compression "none."
|
||||
*/
|
||||
int pad_uncompressed;
|
||||
int pad_uncompressed_byte; /* TODO: Support this. */
|
||||
|
||||
/* File offset of beginning of most recently-read header. */
|
||||
off_t header_position;
|
||||
|
||||
@ -141,18 +116,6 @@ struct archive_read {
|
||||
} formats[8];
|
||||
struct archive_format_descriptor *format; /* Active format. */
|
||||
|
||||
/*
|
||||
* Pointers to format-specific functions for writing. They're
|
||||
* initialized by archive_write_set_format_XXX() calls.
|
||||
*/
|
||||
int (*format_init)(struct archive *); /* Only used on write. */
|
||||
int (*format_finish)(struct archive *);
|
||||
int (*format_finish_entry)(struct archive *);
|
||||
int (*format_write_header)(struct archive *,
|
||||
struct archive_entry *);
|
||||
ssize_t (*format_write_data)(struct archive *,
|
||||
const void *buff, size_t);
|
||||
|
||||
/*
|
||||
* Various information needed by archive_extract.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user