summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorBrandon Casey <casey@nrlssc.navy.mil>2008-10-09 14:12:12 -0500
committerShawn O. Pearce <spearce@spearce.org>2008-10-12 12:36:19 -0700
commitf285a2d7ed6548666989406de8f0e7233eb84368 (patch)
tree2e422bd9ceeeb432ca03b61f91165790f0e37146 /wt-status.c
parent7e7abea96b8140c592a46293f5e33aae0683c7ac (diff)
downloadgit-f285a2d7ed6548666989406de8f0e7233eb84368.tar.gz
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>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/wt-status.c b/wt-status.c
index 7cf890f243..d2eac36aea 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -103,10 +103,8 @@ static void wt_status_print_filepair(struct wt_status *s,
{
const char *c = color(t);
const char *one, *two;
- struct strbuf onebuf, twobuf;
+ struct strbuf onebuf = STRBUF_INIT, twobuf = STRBUF_INIT;
- strbuf_init(&onebuf, 0);
- strbuf_init(&twobuf, 0);
one = quote_path(p->one->path, -1, &onebuf, s->prefix);
two = quote_path(p->two->path, -1, &twobuf, s->prefix);
@@ -190,9 +188,8 @@ static void wt_status_print_changed_cb(struct diff_queue_struct *q,
static void wt_status_print_initial(struct wt_status *s)
{
int i;
- struct strbuf buf;
+ struct strbuf buf = STRBUF_INIT;
- strbuf_init(&buf, 0);
if (active_nr) {
s->commitable = 1;
wt_status_print_cached_header(s);
@@ -268,9 +265,8 @@ static void wt_status_print_untracked(struct wt_status *s)
struct dir_struct dir;
int i;
int shown_header = 0;
- struct strbuf buf;
+ struct strbuf buf = STRBUF_INIT;
- strbuf_init(&buf, 0);
memset(&dir, 0, sizeof(dir));
if (!s->untracked) {