mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-13 19:01:55 +00:00
Make examples/diff.c compile vs threadsafe library
This commit is contained in:
parent
58206c9ae7
commit
8d78400142
@ -117,7 +117,10 @@ int main(int argc, char *argv[])
|
|||||||
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
||||||
git_diff_list *diff;
|
git_diff_list *diff;
|
||||||
int i, color = -1, compact = 0, cached = 0;
|
int i, color = -1, compact = 0, cached = 0;
|
||||||
char *a, *dir = ".", *treeish1 = NULL, *treeish2 = NULL;
|
char *a, *treeish1 = NULL, *treeish2 = NULL;
|
||||||
|
const char *dir = ".";
|
||||||
|
|
||||||
|
git_threads_init();
|
||||||
|
|
||||||
/* parse arguments as copied from git-diff */
|
/* parse arguments as copied from git-diff */
|
||||||
|
|
||||||
@ -162,7 +165,8 @@ int main(int argc, char *argv[])
|
|||||||
!check_uint16_param(a, "--inter-hunk-context=",
|
!check_uint16_param(a, "--inter-hunk-context=",
|
||||||
&opts.interhunk_lines) &&
|
&opts.interhunk_lines) &&
|
||||||
!check_str_param(a, "--src-prefix=", &opts.old_prefix) &&
|
!check_str_param(a, "--src-prefix=", &opts.old_prefix) &&
|
||||||
!check_str_param(a, "--dst-prefix=", &opts.new_prefix))
|
!check_str_param(a, "--dst-prefix=", &opts.new_prefix) &&
|
||||||
|
!check_str_param(a, "--git-dir=", &dir))
|
||||||
usage("Unknown arg", a);
|
usage("Unknown arg", a);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,6 +220,8 @@ int main(int argc, char *argv[])
|
|||||||
git_tree_free(t2);
|
git_tree_free(t2);
|
||||||
git_repository_free(repo);
|
git_repository_free(repo);
|
||||||
|
|
||||||
|
git_threads_shutdown();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user