use strbuf_addbuf() for appending a strbuf to another
Use strbuf_addbuf() where possible; it's shorter and more efficient. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Jul 19, 2016 at 20:36 UTC
8109984d619467ad26c6a76d59b0a5de8a86e6d6
3 files changed
+3
-3
dir.c
+1
-1
@@ -2346,7 +2346,7 @@ void write_untracked_extension(struct strbuf *out, struct untracked_cache *untra
2346
2347
varint_len = encode_varint(untracked->ident.len, varbuf);
2348
strbuf_add(out, varbuf, varint_len);
2349
- strbuf_add(out, untracked->ident.buf, untracked->ident.len);
2349
+ strbuf_addbuf(out, &untracked->ident);
2350
2351
strbuf_add(out, ouc, ouc_size(len));
2352
free(ouc);
path.c
+1
-1
@@ -246,7 +246,7 @@ static void do_submodule_path(struct strbuf *buf, const char *path,
246
strbuf_addstr(buf, git_dir);
247
}
248
strbuf_addch(buf, '/');
249
- strbuf_addstr(&git_submodule_dir, buf->buf);
249
+ strbuf_addbuf(&git_submodule_dir, buf);
250
251
strbuf_vaddf(buf, fmt, args);
252
wt-status.c
+1
-1
@@ -1060,7 +1060,7 @@ static void abbrev_sha1_in_line(struct strbuf *line)
1060
strbuf_addf(split[1], "%s ", abbrev);
1061
strbuf_reset(line);
1062
for (i = 0; split[i]; i++)
1063
- strbuf_addf(line, "%s", split[i]->buf);
1063
+ strbuf_addbuf(line, split[i]);
1064
}
1065
}
1066
for (i = 0; split[i]; i++)