Skip to content

Commit 96b9e51

Browse files
rscharfegitster
authored andcommitted
archive: rename archiver data field to filter_command
The void pointer "data" in struct archiver is only used to store filter commands to pass tar archives to, like gzip. Rename it accordingly and also turn it into a char pointer to document the fact that it's a string reference. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 650134a commit 96b9e51

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

archive-tar.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ static int tar_filter_config(const char *var, const char *value, void *data)
383383
if (!strcmp(type, "command")) {
384384
if (!value)
385385
return config_error_nonbool(var);
386-
free(ar->data);
387-
ar->data = xstrdup(value);
386+
free(ar->filter_command);
387+
ar->filter_command = xstrdup(value);
388388
return 0;
389389
}
390390
if (!strcmp(type, "remote")) {
@@ -432,10 +432,10 @@ static int write_tar_filter_archive(const struct archiver *ar,
432432
struct child_process filter = CHILD_PROCESS_INIT;
433433
int r;
434434

435-
if (!ar->data)
435+
if (!ar->filter_command)
436436
BUG("tar-filter archiver called with no filter defined");
437437

438-
strbuf_addstr(&cmd, ar->data);
438+
strbuf_addstr(&cmd, ar->filter_command);
439439
if (args->compression_level >= 0)
440440
strbuf_addf(&cmd, " -%d", args->compression_level);
441441

@@ -478,7 +478,7 @@ void init_tar_archiver(void)
478478
git_config(git_tar_config, NULL);
479479
for (i = 0; i < nr_tar_filters; i++) {
480480
/* omit any filters that never had a command configured */
481-
if (tar_filters[i]->data)
481+
if (tar_filters[i]->filter_command)
482482
register_archiver(tar_filters[i]);
483483
}
484484
}

archive.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct archiver {
4343
const char *name;
4444
int (*write_archive)(const struct archiver *, struct archiver_args *);
4545
unsigned flags;
46-
void *data;
46+
char *filter_command;
4747
};
4848
void register_archiver(struct archiver *);
4949

0 commit comments

Comments
 (0)