Refactor the code into separate files

Separate repository/odb functions into their own file. Add odb_exists
to go through the repository's odb. Adjust the test script.
This commit is contained in:
Carlos Martín Nieto
2012-08-14 02:22:46 +02:00
parent a6c03f17df
commit 27e72e5173
6 changed files with 176 additions and 59 deletions

29
c_src/repository.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef GEEF_REPOSTIORY_H
#define GEEF_REPOSTIORY_H
#include "erl_nif.h"
#include <git2.h>
#define MAXBUFLEN 1024
ERL_NIF_TERM geef_repository_open(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]);
ERL_NIF_TERM geef_repository_path(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]);
ERL_NIF_TERM geef_repository_odb(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]);
ERL_NIF_TERM geef_odb_exists(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]);
void geef_repository_free(ErlNifEnv *env, void *cd);
void geef_odb_free(ErlNifEnv *env, void *cd);
extern ErlNifResourceType *geef_repository_type;
extern ErlNifResourceType *geef_odb_type;
typedef struct {
git_repository *repo;
} geef_repository;
typedef struct {
git_odb *odb;
} geef_odb;
#endif