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 <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:

committed by
Shawn O. Pearce

parent
7e7abea96b
commit
f285a2d7ed
@ -252,7 +252,7 @@ void log_write_email_headers(struct rev_info *opt, const char *name,
|
||||
|
||||
void show_log(struct rev_info *opt)
|
||||
{
|
||||
struct strbuf msgbuf;
|
||||
struct strbuf msgbuf = STRBUF_INIT;
|
||||
struct log_info *log = opt->loginfo;
|
||||
struct commit *commit = log->commit, *parent = log->parent;
|
||||
int abbrev = opt->diffopt.abbrev;
|
||||
@ -381,7 +381,6 @@ void show_log(struct rev_info *opt)
|
||||
/*
|
||||
* And then the pretty-printed message itself
|
||||
*/
|
||||
strbuf_init(&msgbuf, 0);
|
||||
if (need_8bit_cte >= 0)
|
||||
need_8bit_cte = has_non_ascii(opt->add_signoff);
|
||||
pretty_print_commit(opt->commit_format, commit, &msgbuf,
|
||||
|
Reference in New Issue
Block a user