Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-09-24 08:52:42 +0400
committerRussell Belfer <rb@github.com>2013-09-24 08:52:42 +0400
commit00e859279e361734aa38adfbbb16d25af0be8bda (patch)
treec3e6c39db191df72ec2adf14f2f5a4505025ab51 /src/diff_print.c
parent713793133f65569561c6ca518f61acdddd1d3b65 (diff)
Clean up unnecessary git_buf_printf calls
This replaces some git_buf_printf calls with simple calls to git_buf_put instead. Also, it fixes a missing va_end inside the git_buf_vprintf implementation.
Diffstat (limited to 'src/diff_print.c')
-rw-r--r--src/diff_print.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/diff_print.c b/src/diff_print.c
index ee4b5fc17..fd18b67e3 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -336,7 +336,7 @@ static int diff_print_patch_hunk(
return 0;
git_buf_clear(pi->buf);
- if (git_buf_printf(pi->buf, "%.*s", (int)header_len, header) < 0)
+ if (git_buf_put(pi->buf, header, header_len) < 0)
return -1;
if (pi->print_cb(d, r, GIT_DIFF_LINE_HUNK_HDR,
@@ -360,13 +360,14 @@ static int diff_print_patch_line(
return 0;
git_buf_clear(pi->buf);
+ git_buf_grow(pi->buf, content_len + 2);
if (line_origin == GIT_DIFF_LINE_ADDITION ||
line_origin == GIT_DIFF_LINE_DELETION ||
line_origin == GIT_DIFF_LINE_CONTEXT)
- git_buf_printf(pi->buf, "%c%.*s", line_origin, (int)content_len, content);
- else if (content_len > 0)
- git_buf_printf(pi->buf, "%.*s", (int)content_len, content);
+ git_buf_putc(pi->buf, line_origin);
+
+ git_buf_put(pi->buf, content, content_len);
if (git_buf_oom(pi->buf))
return -1;