From f285a2d7ed6548666989406de8f0e7233eb84368 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Thu, 9 Oct 2008 14:12:12 -0500 Subject: Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializer Many call sites use strbuf_init(&foo, 0) to initialize local strbuf variable "foo" which has not been accessed since its declaration. These can be replaced with a static initialization using the STRBUF_INIT macro which is just as readable, saves a function call, and takes up fewer lines. Signed-off-by: Brandon Casey Signed-off-by: Shawn O. Pearce --- archive-tar.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'archive-tar.c') diff --git a/archive-tar.c b/archive-tar.c index 13029619e..ba890ebde 100644 --- a/archive-tar.c +++ b/archive-tar.c @@ -124,11 +124,10 @@ static int write_tar_entry(struct archiver_args *args, unsigned int mode, void *buffer, unsigned long size) { struct ustar_header header; - struct strbuf ext_header; + struct strbuf ext_header = STRBUF_INIT; int err = 0; memset(&header, 0, sizeof(header)); - strbuf_init(&ext_header, 0); if (!sha1) { *header.typeflag = TYPEFLAG_GLOBAL_HEADER; @@ -211,10 +210,9 @@ static int write_tar_entry(struct archiver_args *args, static int write_global_extended_header(struct archiver_args *args) { const unsigned char *sha1 = args->commit_sha1; - struct strbuf ext_header; + struct strbuf ext_header = STRBUF_INIT; int err; - strbuf_init(&ext_header, 0); strbuf_append_ext_header(&ext_header, "comment", sha1_to_hex(sha1), 40); err = write_tar_entry(args, NULL, NULL, 0, 0, ext_header.buf, ext_header.len); -- cgit v1.2.1