Skip to content

Commit 5caeeb8

Browse files
peffgitster
authored andcommitted
archive-tar: drop return value
We never do any error checks, and so never return anything but "0". Let's just drop this to simplify the code. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6e8e099 commit 5caeeb8

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

archive-tar.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,12 @@ static int write_tar_entry(struct archiver_args *args,
319319
return err;
320320
}
321321

322-
static int write_global_extended_header(struct archiver_args *args)
322+
static void write_global_extended_header(struct archiver_args *args)
323323
{
324324
const unsigned char *sha1 = args->commit_sha1;
325325
struct strbuf ext_header = STRBUF_INIT;
326326
struct ustar_header header;
327327
unsigned int mode;
328-
int err = 0;
329328

330329
if (sha1)
331330
strbuf_append_ext_header(&ext_header, "comment",
@@ -337,7 +336,7 @@ static int write_global_extended_header(struct archiver_args *args)
337336
}
338337

339338
if (!ext_header.len)
340-
return 0;
339+
return;
341340

342341
memset(&header, 0, sizeof(header));
343342
*header.typeflag = TYPEFLAG_GLOBAL_HEADER;
@@ -347,7 +346,6 @@ static int write_global_extended_header(struct archiver_args *args)
347346
write_blocked(&header, sizeof(header));
348347
write_blocked(ext_header.buf, ext_header.len);
349348
strbuf_release(&ext_header);
350-
return err;
351349
}
352350

353351
static struct archiver **tar_filters;
@@ -423,9 +421,8 @@ static int write_tar_archive(const struct archiver *ar,
423421
{
424422
int err = 0;
425423

426-
err = write_global_extended_header(args);
427-
if (!err)
428-
err = write_archive_entries(args, write_tar_entry);
424+
write_global_extended_header(args);
425+
err = write_archive_entries(args, write_tar_entry);
429426
if (!err)
430427
write_trailer();
431428
return err;

0 commit comments

Comments
 (0)