summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2020-05-28 13:51:16 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2020-05-29 11:33:58 +0100
commit05c77961a0fc43ed552e10a166864086c9f04a0a (patch)
tree7a4899d0d272d5b13b4bf0904ef696ae949cdc8b
parent5d012010943d324386ca9d443102748a7763a6d1 (diff)
downloadlibgit2-05c77961a0fc43ed552e10a166864086c9f04a0a.tar.gz
examples: use git_userbuf
-rw-r--r--examples/describe.c2
-rw-r--r--examples/diff.c8
-rw-r--r--examples/tag.c4
3 files changed, 7 insertions, 7 deletions
diff --git a/examples/describe.c b/examples/describe.c
index 1236272a1..4c004f753 100644
--- a/examples/describe.c
+++ b/examples/describe.c
@@ -59,7 +59,7 @@ static void do_describe_single(git_repository *repo, struct describe_options *op
{
git_object *commit;
git_describe_result *describe_result;
- git_buf buf = { 0 };
+ git_userbuf buf = GIT_USERBUF_INIT;
if (rev) {
check_lg2(git_revparse_single(&commit, repo, rev),
diff --git a/examples/diff.c b/examples/diff.c
index 2305c8652..27142613b 100644
--- a/examples/diff.c
+++ b/examples/diff.c
@@ -169,7 +169,7 @@ static void compute_diff_no_index(git_diff **diff, struct diff_options *o) {
git_patch *patch = NULL;
char *file1_str = NULL;
char *file2_str = NULL;
- git_buf buf = {0};
+ git_userbuf buf = GIT_USERBUF_INIT;
if (!o->treeish1 || !o->treeish2) {
usage("two files should be provided as arguments", NULL);
@@ -192,7 +192,7 @@ static void compute_diff_no_index(git_diff **diff, struct diff_options *o) {
git_diff_from_buffer(diff, buf.ptr, buf.size),
"diff from patch", NULL);
git_patch_free(patch);
- git_buf_dispose(&buf);
+ git_userbuf_dispose(&buf);
free(file1_str);
free(file2_str);
}
@@ -344,7 +344,7 @@ static void parse_opts(struct diff_options *o, int argc, char *argv[])
static void diff_print_stats(git_diff *diff, struct diff_options *o)
{
git_diff_stats *stats;
- git_buf b = GIT_BUF_INIT_CONST(NULL, 0);
+ git_userbuf b = GIT_USERBUF_INIT;
git_diff_stats_format_t format = 0;
check_lg2(
@@ -364,6 +364,6 @@ static void diff_print_stats(git_diff *diff, struct diff_options *o)
fputs(b.ptr, stdout);
- git_buf_dispose(&b);
+ git_userbuf_dispose(&b);
git_diff_stats_free(stats);
}
diff --git a/examples/tag.c b/examples/tag.c
index 440829419..e68a40907 100644
--- a/examples/tag.c
+++ b/examples/tag.c
@@ -169,7 +169,7 @@ static void action_delete_tag(tag_state *state)
{
struct tag_options *opts = state->opts;
git_object *obj;
- git_buf abbrev_oid = {0};
+ git_userbuf abbrev_oid = GIT_USERBUF_INIT;
check(!opts->tag_name, "Name required");
@@ -184,7 +184,7 @@ static void action_delete_tag(tag_state *state)
printf("Deleted tag '%s' (was %s)\n", opts->tag_name, abbrev_oid.ptr);
- git_buf_dispose(&abbrev_oid);
+ git_userbuf_dispose(&abbrev_oid);
git_object_free(obj);
}