summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-10-23 17:34:41 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-11-08 23:46:39 +0100
commit799e22ea0c3f20f1900011573a10053dc3ea9138 (patch)
tree43af7e21e2872ee3b83a1478ceb75b068b100a1c /examples
parent4865cc3f0631a8a4e0e1de897865df0e552c70cb (diff)
downloadlibgit2-799e22ea0c3f20f1900011573a10053dc3ea9138.tar.gz
Rename git_threads_ to git_libgit2_
This describes their purpose better, as we now initialize ssl and some other global stuff in there. Calling the init function is not something which has been optional for a while now.
Diffstat (limited to 'examples')
-rw-r--r--examples/add.c4
-rw-r--r--examples/blame.c4
-rw-r--r--examples/cat-file.c4
-rw-r--r--examples/describe.c4
-rw-r--r--examples/diff.c4
-rw-r--r--examples/general.c4
-rw-r--r--examples/init.c4
-rw-r--r--examples/log.c4
-rw-r--r--examples/network/git2.c2
-rw-r--r--examples/rev-list.c4
-rw-r--r--examples/rev-parse.c4
-rw-r--r--examples/showindex.c4
-rw-r--r--examples/status.c4
-rw-r--r--examples/tag.c4
14 files changed, 29 insertions, 25 deletions
diff --git a/examples/add.c b/examples/add.c
index 0c6076e81..0101ab9ae 100644
--- a/examples/add.c
+++ b/examples/add.c
@@ -40,7 +40,7 @@ int main (int argc, char** argv)
int options = 0, count = 0;
struct print_payload payload = {0};
- git_threads_init();
+ git_libgit2_init();
parse_opts(&options, &count, argc, argv);
@@ -66,7 +66,7 @@ int main (int argc, char** argv)
git_index_free(index);
git_repository_free(repo);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/blame.c b/examples/blame.c
index fda605bce..9d38f25a4 100644
--- a/examples/blame.c
+++ b/examples/blame.c
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
git_blob *blob;
git_object *obj;
- git_threads_init();
+ git_libgit2_init();
parse_opts(&o, argc, argv);
if (o.M) blameopts.flags |= GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES;
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
git_blame_free(blame);
git_repository_free(repo);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/cat-file.c b/examples/cat-file.c
index 52399fa8a..f948740a1 100644
--- a/examples/cat-file.c
+++ b/examples/cat-file.c
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
git_object *obj = NULL;
char oidstr[GIT_OID_HEXSZ + 1];
- git_threads_init();
+ git_libgit2_init();
parse_opts(&o, argc, argv);
@@ -190,7 +190,7 @@ int main(int argc, char *argv[])
git_object_free(obj);
git_repository_free(repo);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/describe.c b/examples/describe.c
index cbf73b012..09a4fd008 100644
--- a/examples/describe.c
+++ b/examples/describe.c
@@ -145,7 +145,7 @@ int main(int argc, char **argv)
git_repository *repo;
describe_options opts;
- git_threads_init();
+ git_libgit2_init();
check_lg2(git_repository_open_ext(&repo, ".", 0, NULL),
"Could not open repository", NULL);
@@ -156,7 +156,7 @@ int main(int argc, char **argv)
do_describe(repo, &opts);
git_repository_free(repo);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/diff.c b/examples/diff.c
index 76ac2f311..b69cb2218 100644
--- a/examples/diff.c
+++ b/examples/diff.c
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
-1, 0, 0, GIT_DIFF_FORMAT_PATCH, NULL, NULL, "."
};
- git_threads_init();
+ git_libgit2_init();
parse_opts(&o, argc, argv);
@@ -163,7 +163,7 @@ int main(int argc, char *argv[])
git_tree_free(t2);
git_repository_free(repo);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/general.c b/examples/general.c
index 051d69380..8981cacab 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -59,6 +59,10 @@ static void check_error(int error_code, const char *action)
int main (int argc, char** argv)
{
+ // Initialize the library, this will set up any global state which libgit2 needs
+ // including threading and crypto
+ git_libgit2_init();
+
// ### Opening the Repository
// There are a couple of methods for opening a repository, this being the
diff --git a/examples/init.c b/examples/init.c
index 0e823ab81..fe7a67224 100644
--- a/examples/init.c
+++ b/examples/init.c
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
git_repository *repo = NULL;
struct opts o = { 1, 0, 0, 0, GIT_REPOSITORY_INIT_SHARED_UMASK, 0, 0, 0 };
- git_threads_init();
+ git_libgit2_init();
parse_opts(&o, argc, argv);
@@ -116,7 +116,7 @@ int main(int argc, char *argv[])
}
git_repository_free(repo);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/log.c b/examples/log.c
index d5f75a297..e54eed3ce 100644
--- a/examples/log.c
+++ b/examples/log.c
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
git_commit *commit = NULL;
git_pathspec *ps = NULL;
- git_threads_init();
+ git_libgit2_init();
/** Parse arguments and set up revwalker. */
@@ -180,7 +180,7 @@ int main(int argc, char *argv[])
git_pathspec_free(ps);
git_revwalk_free(s.walker);
git_repository_free(s.repo);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/network/git2.c b/examples/network/git2.c
index 5b32ac809..d44334b85 100644
--- a/examples/network/git2.c
+++ b/examples/network/git2.c
@@ -54,7 +54,7 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
- git_threads_init();
+ git_libgit2_init();
for (i = 0; commands[i].name != NULL; ++i) {
if (!strcmp(argv[1], commands[i].name))
diff --git a/examples/rev-list.c b/examples/rev-list.c
index 940a01136..ee9afc441 100644
--- a/examples/rev-list.c
+++ b/examples/rev-list.c
@@ -24,7 +24,7 @@ int main (int argc, char **argv)
git_oid oid;
char buf[GIT_OID_HEXSZ+1];
- git_threads_init();
+ git_libgit2_init();
check_lg2(git_repository_open_ext(&repo, ".", 0, NULL), "opening repository", NULL);
check_lg2(git_revwalk_new(&walk, repo), "allocating revwalk", NULL);
@@ -36,7 +36,7 @@ int main (int argc, char **argv)
printf("%s\n", buf);
}
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/rev-parse.c b/examples/rev-parse.c
index a24833767..483d6e019 100644
--- a/examples/rev-parse.c
+++ b/examples/rev-parse.c
@@ -29,13 +29,13 @@ int main(int argc, char *argv[])
{
struct parse_state ps = {0};
- git_threads_init();
+ git_libgit2_init();
parse_opts(&ps, argc, argv);
check_lg2(parse_revision(&ps), "Parsing", NULL);
git_repository_free(ps.repo);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/showindex.c b/examples/showindex.c
index 604124f12..43be5e24c 100644
--- a/examples/showindex.c
+++ b/examples/showindex.c
@@ -23,7 +23,7 @@ int main (int argc, char** argv)
char out[GIT_OID_HEXSZ+1];
out[GIT_OID_HEXSZ] = '\0';
- git_threads_init();
+ git_libgit2_init();
if (argc > 2)
fatal("usage: showindex [<repo-dir>]", NULL);
@@ -64,7 +64,7 @@ int main (int argc, char** argv)
}
git_index_free(index);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/status.c b/examples/status.c
index a59f34454..62cb5b24f 100644
--- a/examples/status.c
+++ b/examples/status.c
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
git_status_list *status;
struct opts o = { GIT_STATUS_OPTIONS_INIT, "." };
- git_threads_init();
+ git_libgit2_init();
o.statusopt.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
o.statusopt.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
@@ -135,7 +135,7 @@ show_status:
}
git_repository_free(repo);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}
diff --git a/examples/tag.c b/examples/tag.c
index 1d254aee5..c6a70d90e 100644
--- a/examples/tag.c
+++ b/examples/tag.c
@@ -300,7 +300,7 @@ int main(int argc, char **argv)
tag_action action;
tag_state state;
- git_threads_init();
+ git_libgit2_init();
check_lg2(git_repository_open_ext(&repo, ".", 0, NULL),
"Could not open repository", NULL);
@@ -313,7 +313,7 @@ int main(int argc, char **argv)
action(&state);
git_repository_free(repo);
- git_threads_shutdown();
+ git_libgit2_shutdown();
return 0;
}