diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2020-05-28 13:51:16 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-06-05 07:14:24 +0100 |
commit | 46a4add72c4ffab36bf94a24d09bba4cb47509db (patch) | |
tree | 382ad50214d2aeaf923f95276606f0660ebf14b9 | |
parent | a1b82e5c77ee66602aff5da1da8327fa4b15fc97 (diff) | |
download | libgit2-46a4add72c4ffab36bf94a24d09bba4cb47509db.tar.gz |
examples: use git_userbuf
-rw-r--r-- | examples/describe.c | 2 | ||||
-rw-r--r-- | examples/diff.c | 8 | ||||
-rw-r--r-- | examples/tag.c | 4 |
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 03d9c2bf9..d0a5818a4 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); } |