Remove old object_exists

This commit is contained in:
Carlos Martín Nieto
2012-08-14 11:43:40 +02:00
parent f20fe2d0e1
commit 69ddae5b54
2 changed files with 1 additions and 31 deletions

View File

@@ -29,32 +29,6 @@ geef_hex_to_raw(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
return enif_make_binary(env, &ibin);
}
static ERL_NIF_TERM
geef_object_exists(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
char path[MAXBUFLEN];
char sha[MAXBUFLEN];
(void)memset(&path, '\0', sizeof(path));
(void)memset(&sha, '\0', sizeof(sha));
if (enif_get_string(env, argv[0], path, sizeof(path), ERL_NIF_LATIN1) < 1)
return enif_make_badarg(env);
if (enif_get_string(env, argv[1], sha, sizeof(sha), ERL_NIF_LATIN1) < 1)
return enif_make_badarg(env);
git_odb *odb;
git_odb_open(&odb, path);
git_oid oid;
git_oid_fromstr(&oid, sha);
int exists = git_odb_exists(odb, &oid);
if(exists == 1) {
return enif_make_atom(env, "true");
}
return enif_make_atom(env, "false");
}
static int load(ErlNifEnv *env, void **priv, ERL_NIF_TERM load_info)
{
geef_repository_type = enif_open_resource_type(env, NULL,
@@ -96,7 +70,6 @@ geef_error(ErlNifEnv *env)
static ErlNifFunc geef_funcs[] =
{
{"hex_to_raw", 1, geef_hex_to_raw},
{"object_exists", 2, geef_object_exists},
{"repository_open", 1, geef_repository_open},
{"repository_get_path", 1, geef_repository_path},
{"repository_get_odb", 1, geef_repository_odb},