]> git.proxmox.com Git - libgit2.git/blobdiff - examples/general.c
New upstream version 1.1.0+dfsg.1
[libgit2.git] / examples / general.c
index e0f5b5ec5b2aeca502fadedad041fb1b099827c3..1622ff8b008d93a09127a9aa148e55521602439a 100644 (file)
@@ -36,6 +36,8 @@
  * [pg]: https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain
  */
 
+#include "common.h"
+
 /**
  * ### Includes
  *
@@ -43,9 +45,7 @@
  * that you need.  It should be the only thing you need to include in order
  * to compile properly and get all the libgit2 API.
  */
-#include <git2.h>
-#include <stdio.h>
-#include <string.h>
+#include "git2.h"
 
 static void oid_parsing(git_oid *out);
 static void object_database(git_repository *repo, git_oid *oid);
@@ -76,12 +76,11 @@ static void check_error(int error_code, const char *action)
        exit(1);
 }
 
-int main (int argc, char** argv)
+int lg2_general(git_repository *repo, int argc, char** argv)
 {
        int error;
        git_oid oid;
        char *repo_path;
-       git_repository *repo;
 
        /**
         * Initialize the library, this will set up any global state which libgit2 needs
@@ -625,7 +624,7 @@ static void revwalking(git_repository *repo)
 static void index_walking(git_repository *repo)
 {
        git_index *index;
-       unsigned int i, ecount;
+       size_t i, ecount;
 
        printf("\n*Index Walking*\n");
 
@@ -708,7 +707,7 @@ static void reference_listing(git_repository *repo)
                git_reference_free(ref);
        }
 
-       git_strarray_free(&ref_list);
+       git_strarray_dispose(&ref_list);
 }
 
 /**