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:
29
c_src/repository.h
Normal file
29
c_src/repository.h
Normal 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
|
||||
Reference in New Issue
Block a user