Use const pointers when possible
This commit is contained in:
parent
1633012823
commit
2aed955e94
@ -6,9 +6,9 @@
|
||||
|
||||
// all of these are defined in util.c
|
||||
int minitar_read_header(struct minitar*, struct tar_header*);
|
||||
int minitar_validate_header(struct tar_header*);
|
||||
void minitar_parse_tar_header(struct tar_header*, struct minitar_entry_metadata*);
|
||||
struct minitar_entry* minitar_dup_entry(struct minitar_entry*);
|
||||
int minitar_validate_header(const struct tar_header*);
|
||||
void minitar_parse_tar_header(const struct tar_header*, struct minitar_entry_metadata*);
|
||||
struct minitar_entry* minitar_dup_entry(const struct minitar_entry*);
|
||||
char* minitar_read_file_contents(struct minitar_entry_metadata*, struct minitar*);
|
||||
|
||||
struct minitar* minitar_open(const char* pathname)
|
||||
|
@ -18,7 +18,7 @@ noreturn void minitar_panic(const char* message)
|
||||
minitar_handle_panic(message);
|
||||
}
|
||||
|
||||
void minitar_parse_tar_header(struct tar_header* hdr, struct minitar_entry_metadata* metadata)
|
||||
void minitar_parse_tar_header(const struct tar_header* hdr, struct minitar_entry_metadata* metadata)
|
||||
{
|
||||
if (!strlen(hdr->prefix))
|
||||
{
|
||||
@ -64,7 +64,7 @@ void minitar_parse_tar_header(struct tar_header* hdr, struct minitar_entry_metad
|
||||
strcpy(metadata->gname, hdr->gname);
|
||||
}
|
||||
|
||||
int minitar_validate_header(struct tar_header* hdr)
|
||||
int minitar_validate_header(const struct tar_header* hdr)
|
||||
{
|
||||
if (hdr->typeflag != '\0' && hdr->typeflag != '0' && hdr->typeflag != '1' && hdr->typeflag != '2' &&
|
||||
hdr->typeflag != '3' && hdr->typeflag != '4' && hdr->typeflag != '5' && hdr->typeflag != '6')
|
||||
@ -81,7 +81,7 @@ int minitar_read_header(struct minitar* mp, struct tar_header* hdr)
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct minitar_entry* minitar_dup_entry(struct minitar_entry* original)
|
||||
struct minitar_entry* minitar_dup_entry(const struct minitar_entry* original)
|
||||
{
|
||||
struct minitar_entry* new = malloc(sizeof *original);
|
||||
if (!new) return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user