diff options
-rw-r--r-- | examples/general.c | 12 | ||||
-rw-r--r-- | include/git2/blob.h | 6 | ||||
-rw-r--r-- | include/git2/commit.h | 6 | ||||
-rw-r--r-- | include/git2/object.h | 6 | ||||
-rw-r--r-- | include/git2/odb.h | 2 | ||||
-rw-r--r-- | include/git2/repository.h | 2 | ||||
-rw-r--r-- | include/git2/tag.h | 6 | ||||
-rw-r--r-- | include/git2/tree.h | 8 | ||||
-rw-r--r-- | src/blob.c | 2 | ||||
-rw-r--r-- | src/object.c | 8 | ||||
-rw-r--r-- | src/odb.c | 8 | ||||
-rw-r--r-- | src/refs.c | 2 | ||||
-rw-r--r-- | src/revwalk.c | 4 | ||||
-rw-r--r-- | src/status.c | 10 | ||||
-rw-r--r-- | src/tag.c | 2 | ||||
-rw-r--r-- | src/transports/local.c | 2 | ||||
-rw-r--r-- | src/tree.c | 4 | ||||
-rw-r--r-- | tests-clay/object/tree/frompath.c | 4 | ||||
-rw-r--r-- | tests-clay/odb/loose.c | 2 | ||||
-rw-r--r-- | tests-clay/odb/packed.c | 7 | ||||
-rw-r--r-- | tests/t03-objwrite.c | 14 | ||||
-rw-r--r-- | tests/t04-commit.c | 18 | ||||
-rw-r--r-- | tests/t08-tag.c | 22 | ||||
-rw-r--r-- | tests/t09-tree.c | 18 | ||||
-rw-r--r-- | tests/t10-refs.c | 8 |
25 files changed, 92 insertions, 91 deletions
diff --git a/examples/general.c b/examples/general.c index 8b58fa6ff..c67ff6f64 100644 --- a/examples/general.c +++ b/examples/general.c @@ -107,7 +107,7 @@ int main (int argc, char** argv) // For proper memory management, close the object when you are done with it or it will leak // memory. - git_odb_object_close(obj); + git_odb_object_free(obj); // #### Raw Object Writing @@ -167,12 +167,12 @@ int main (int argc, char** argv) git_commit_parent(&parent, commit, p); git_oid_fmt(out, git_commit_id(parent)); printf("Parent: %s\n", out); - git_commit_close(parent); + git_commit_free(parent); } // Don't forget to close the object to prevent memory leaks. You will have to do this for // all the objects you open and parse. - git_commit_close(commit); + git_commit_free(commit); // #### Writing Commits // @@ -243,7 +243,7 @@ int main (int argc, char** argv) tmessage = git_tag_message(tag); // "tag message\n" printf("Tag Message: %s\n", tmessage); - git_commit_close(commit); + git_commit_free(commit); // #### Tree Parsing // [Tree parsing][tp] is a bit different than the other objects, in that we have a subtype which is the @@ -276,7 +276,7 @@ int main (int argc, char** argv) git_tree_entry_2object(&objt, repo, entry); // blob // Remember to close the looked-up object once you are done using it - git_object_close(objt); + git_object_free(objt); // #### Blob Parsing // @@ -340,7 +340,7 @@ int main (int argc, char** argv) cmsg = git_commit_message(wcommit); cauth = git_commit_author(wcommit); printf("%s (%s)\n", cmsg, cauth->email); - git_commit_close(wcommit); + git_commit_free(wcommit); } // Like the other objects, be sure to free the revwalker when you're done to prevent memory leaks. diff --git a/include/git2/blob.h b/include/git2/blob.h index b2a2b034a..8b9380d82 100644 --- a/include/git2/blob.h +++ b/include/git2/blob.h @@ -54,7 +54,7 @@ GIT_INLINE(int) git_blob_lookup_prefix(git_blob **blob, git_repository *repo, co /** * Close an open blob * - * This is a wrapper around git_object_close() + * This is a wrapper around git_object_free() * * IMPORTANT: * It *is* necessary to call this method when you stop @@ -63,9 +63,9 @@ GIT_INLINE(int) git_blob_lookup_prefix(git_blob **blob, git_repository *repo, co * @param blob the blob to close */ -GIT_INLINE(void) git_blob_close(git_blob *blob) +GIT_INLINE(void) git_blob_free(git_blob *blob) { - git_object_close((git_object *) blob); + git_object_free((git_object *) blob); } diff --git a/include/git2/commit.h b/include/git2/commit.h index 3c90e8007..4e91b34b9 100644 --- a/include/git2/commit.h +++ b/include/git2/commit.h @@ -56,7 +56,7 @@ GIT_INLINE(int) git_commit_lookup_prefix(git_commit **commit, git_repository *re /** * Close an open commit * - * This is a wrapper around git_object_close() + * This is a wrapper around git_object_free() * * IMPORTANT: * It *is* necessary to call this method when you stop @@ -65,9 +65,9 @@ GIT_INLINE(int) git_commit_lookup_prefix(git_commit **commit, git_repository *re * @param commit the commit to close */ -GIT_INLINE(void) git_commit_close(git_commit *commit) +GIT_INLINE(void) git_commit_free(git_commit *commit) { - git_object_close((git_object *) commit); + git_object_free((git_object *) commit); } /** diff --git a/include/git2/object.h b/include/git2/object.h index d82a71c3c..86a0a585d 100644 --- a/include/git2/object.h +++ b/include/git2/object.h @@ -24,7 +24,7 @@ GIT_BEGIN_DECL * Lookup a reference to one of the objects in a repostory. * * The generated reference is owned by the repository and - * should be closed with the `git_object_close` method + * should be closed with the `git_object_free` method * instead of free'd manually. * * The 'type' parameter must match the type of the object @@ -56,7 +56,7 @@ GIT_EXTERN(int) git_object_lookup( * the prefix; otherwise the method will fail. * * The generated reference is owned by the repository and - * should be closed with the `git_object_close` method + * should be closed with the `git_object_free` method * instead of free'd manually. * * The 'type' parameter must match the type of the object @@ -123,7 +123,7 @@ GIT_EXTERN(git_repository *) git_object_owner(const git_object *obj); * * @param object the object to close */ -GIT_EXTERN(void) git_object_close(git_object *object); +GIT_EXTERN(void) git_object_free(git_object *object); /** * Convert an object type to it's string representation. diff --git a/include/git2/odb.h b/include/git2/odb.h index b99c40e00..b144eca7d 100644 --- a/include/git2/odb.h +++ b/include/git2/odb.h @@ -282,7 +282,7 @@ GIT_EXTERN(int) git_odb_hashfile(git_oid *out, const char *path, git_otype type) * * @param object object to close */ -GIT_EXTERN(void) git_odb_object_close(git_odb_object *object); +GIT_EXTERN(void) git_odb_object_free(git_odb_object *object); /** * Return the OID of an ODB object diff --git a/include/git2/repository.h b/include/git2/repository.h index bacb48145..ced5ad572 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -75,7 +75,7 @@ GIT_EXTERN(int) git_repository_discover( * * Note that after a repository is free'd, all the objects it has spawned * will still exist until they are manually closed by the user - * with `git_object_close`, but accessing any of the attributes of + * with `git_object_free`, but accessing any of the attributes of * an object without a backing repository will result in undefined * behavior * diff --git a/include/git2/tag.h b/include/git2/tag.h index 63a522882..be49621e9 100644 --- a/include/git2/tag.h +++ b/include/git2/tag.h @@ -54,7 +54,7 @@ GIT_INLINE(int) git_tag_lookup_prefix(git_tag **tag, git_repository *repo, const /** * Close an open tag * - * This is a wrapper around git_object_close() + * This is a wrapper around git_object_free() * * IMPORTANT: * It *is* necessary to call this method when you stop @@ -63,9 +63,9 @@ GIT_INLINE(int) git_tag_lookup_prefix(git_tag **tag, git_repository *repo, const * @param tag the tag to close */ -GIT_INLINE(void) git_tag_close(git_tag *tag) +GIT_INLINE(void) git_tag_free(git_tag *tag) { - git_object_close((git_object *) tag); + git_object_free((git_object *) tag); } diff --git a/include/git2/tree.h b/include/git2/tree.h index 8ac8b1682..fefd4c6c3 100644 --- a/include/git2/tree.h +++ b/include/git2/tree.h @@ -54,7 +54,7 @@ GIT_INLINE(int) git_tree_lookup_prefix(git_tree **tree, git_repository *repo, co /** * Close an open tree * - * This is a wrapper around git_object_close() + * This is a wrapper around git_object_free() * * IMPORTANT: * It *is* necessary to call this method when you stop @@ -63,9 +63,9 @@ GIT_INLINE(int) git_tree_lookup_prefix(git_tree **tree, git_repository *repo, co * @param tree the tree to close */ -GIT_INLINE(void) git_tree_close(git_tree *tree) +GIT_INLINE(void) git_tree_free(git_tree *tree) { - git_object_close((git_object *) tree); + git_object_free((git_object *) tree); } @@ -273,7 +273,7 @@ GIT_EXTERN(int) git_treebuilder_write(git_oid *oid, git_repository *repo, git_tr * relative path. * * The returned tree is owned by the repository and - * should be closed with the `git_object_close` method. + * should be closed with the `git_object_free` method. * * @param subtree Pointer where to store the subtree * @param root A previously loaded tree which will be the root of the relative path diff --git a/src/blob.c b/src/blob.c index 5fd0fd67e..87f5686af 100644 --- a/src/blob.c +++ b/src/blob.c @@ -26,7 +26,7 @@ size_t git_blob_rawsize(git_blob *blob) void git_blob__free(git_blob *blob) { - git_odb_object_close(blob->odb_object); + git_odb_object_free(blob->odb_object); git__free(blob); } diff --git a/src/object.c b/src/object.c index 12947f035..95c7cf9d2 100644 --- a/src/object.c +++ b/src/object.c @@ -109,7 +109,7 @@ int git_object_lookup_prefix( object = git_cache_get(&repo->objects, id); if (object != NULL) { if (type != GIT_OBJ_ANY && type != object->type) { - git_object_close(object); + git_object_free(object); return git__throw(GIT_EINVALIDTYPE, "Failed to lookup object. " "The given type does not match the type on the ODB"); @@ -151,7 +151,7 @@ int git_object_lookup_prefix( return git__rethrow(error, "Failed to lookup object"); if (type != GIT_OBJ_ANY && type != odb_obj->raw.type) { - git_odb_object_close(odb_obj); + git_odb_object_free(odb_obj); return git__throw(GIT_EINVALIDTYPE, "Failed to lookup object. The given type does not match the type on the ODB"); } @@ -185,7 +185,7 @@ int git_object_lookup_prefix( break; } - git_odb_object_close(odb_obj); + git_odb_object_free(odb_obj); if (error < GIT_SUCCESS) { git_object__free(object); @@ -229,7 +229,7 @@ void git_object__free(void *_obj) } } -void git_object_close(git_object *object) +void git_object_free(git_object *object) { if (object == NULL) return; @@ -108,7 +108,7 @@ git_otype git_odb_object_type(git_odb_object *object) return object->raw.type; } -void git_odb_object_close(git_odb_object *object) +void git_odb_object_free(git_odb_object *object) { git_cached_obj_decref((git_cached_obj *)object, &free_odb_object); } @@ -446,7 +446,7 @@ int git_odb_exists(git_odb *db, const git_oid *id) assert(db && id); if ((object = git_cache_get(&db->cache, id)) != NULL) { - git_odb_object_close(object); + git_odb_object_free(object); return 1; } @@ -472,7 +472,7 @@ int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git if ((object = git_cache_get(&db->cache, id)) != NULL) { *len_p = object->raw.len; *type_p = object->raw.type; - git_odb_object_close(object); + git_odb_object_free(object); return GIT_SUCCESS; } @@ -497,7 +497,7 @@ int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git *len_p = object->raw.len; *type_p = object->raw.type; - git_odb_object_close(object); + git_odb_object_free(object); } return GIT_SUCCESS; diff --git a/src/refs.c b/src/refs.c index 4c45fec2c..8931d5bac 100644 --- a/src/refs.c +++ b/src/refs.c @@ -686,7 +686,7 @@ static int packed_find_peel(git_repository *repo, struct packref *ref) */ } - git_object_close(object); + git_object_free(object); return GIT_SUCCESS; } diff --git a/src/revwalk.c b/src/revwalk.c index 64775649c..d632a19b8 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -230,12 +230,12 @@ static int commit_parse(git_revwalk *walk, commit_object *commit) return git__rethrow(error, "Failed to parse commit. Can't read object"); if (obj->raw.type != GIT_OBJ_COMMIT) { - git_odb_object_close(obj); + git_odb_object_free(obj); return git__throw(GIT_EOBJTYPE, "Failed to parse commit. Object is no commit object"); } error = commit_quick_parse(walk, commit, &obj->raw); - git_odb_object_close(obj); + git_odb_object_free(obj); return error == GIT_SUCCESS ? GIT_SUCCESS : git__rethrow(error, "Failed to parse commit"); } diff --git a/src/status.c b/src/status.c index d09abfd69..97093a553 100644 --- a/src/status.c +++ b/src/status.c @@ -162,7 +162,7 @@ static int retrieve_head_tree(git_tree **tree_out, git_repository *repo) *tree_out = tree; exit: - git_commit_close(head_commit); + git_commit_free(head_commit); return error; } @@ -214,7 +214,7 @@ static int process_folder(struct status_st *st, const git_tree_entry *tree_entry } if (tree_entry_type == GIT_OBJ_TREE) { - git_object_close(subtree); + git_object_free(subtree); st->head_tree_relative_path_len -= 1 + tree_entry->filename_len; st->tree = pushed_tree; st->tree_position = pushed_tree_position; @@ -477,7 +477,7 @@ int git_status_foreach(git_repository *repo, int (*callback)(const char *, unsig exit: git_vector_free(&entries); - git_tree_close(tree); + git_tree_free(tree); return error; } @@ -512,7 +512,7 @@ static int recurse_tree_entry(git_tree *tree, struct status_entry *e, const char return git__throw(GIT_EOBJCORRUPTED, "Can't find tree object '%s'", tree_entry->filename); error = recurse_tree_entry(subtree, e, dir_sep+1); - git_tree_close(subtree); + git_tree_free(subtree); return error; } @@ -585,7 +585,7 @@ int git_status_file(unsigned int *status_flags, git_repository *repo, const char *status_flags = e->status_flags; exit: - git_tree_close(tree); + git_tree_free(tree); git__free(e); return error; } @@ -319,7 +319,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu if (tag.type != target_obj->raw.type) return git__throw(error, "The type for the given target is invalid"); - git_odb_object_close(target_obj); + git_odb_object_free(target_obj); error = retrieve_tag_reference(&new_ref, ref_name, repo, tag.tag_name); diff --git a/src/transports/local.c b/src/transports/local.c index 058ed7e79..afc17e55f 100644 --- a/src/transports/local.c +++ b/src/transports/local.c @@ -114,7 +114,7 @@ static int add_ref(const char *name, git_repository *repo, git_vector *vec) git_reference_free(ref); git_reference_free(resolved_ref); - git_object_close(obj); + git_object_free(obj); if (error < GIT_SUCCESS) { git__free(head->name); git__free(head); diff --git a/src/tree.c b/src/tree.c index ec44d2492..702095d14 100644 --- a/src/tree.c +++ b/src/tree.c @@ -680,7 +680,7 @@ static int tree_frompath( slash_pos - treeentry_path + 1 ); - git_tree_close(subtree); + git_tree_free(subtree); return error; } @@ -731,7 +731,7 @@ static int tree_walk_post( payload ); - git_tree_close(subtree); + git_tree_free(subtree); } } diff --git a/tests-clay/object/tree/frompath.c b/tests-clay/object/tree/frompath.c index 7d6f42d6f..06d08ac7b 100644 --- a/tests-clay/object/tree/frompath.c +++ b/tests-clay/object/tree/frompath.c @@ -19,7 +19,7 @@ void test_object_tree_frompath__initialize(void) void test_object_tree_frompath__cleanup(void) { - git_tree_close(tree); + git_tree_free(tree); git_repository_free(repo); cl_fixture_cleanup("testrepo.git"); } @@ -37,7 +37,7 @@ static void assert_tree_from_path(git_tree *root, const char *path, git_error ex cl_assert(git_oid_streq(git_object_id((const git_object *)containing_tree), expected_raw_oid) == GIT_SUCCESS); - git_tree_close(containing_tree); + git_tree_free(containing_tree); } void test_object_tree_frompath__retrieve_tree_from_path_to_treeentry(void) diff --git a/tests-clay/odb/loose.c b/tests-clay/odb/loose.c index 756a157df..1d534704e 100644 --- a/tests-clay/odb/loose.c +++ b/tests-clay/odb/loose.c @@ -39,7 +39,7 @@ static void test_read_object(object_data *data) cmp_objects((git_rawobj *)&obj->raw, data); - git_odb_object_close(obj); + git_odb_object_free(obj); git_odb_free(odb); } diff --git a/tests-clay/odb/packed.c b/tests-clay/odb/packed.c index e50bca631..4e9918d3e 100644 --- a/tests-clay/odb/packed.c +++ b/tests-clay/odb/packed.c @@ -26,7 +26,7 @@ void test_odb_packed__mass_read(void) cl_assert(git_odb_exists(_odb, &id) == 1); cl_git_pass(git_odb_read(&obj, _odb, &id)); - git_odb_object_close(obj); + git_odb_object_free(obj); } } @@ -48,7 +48,7 @@ void test_odb_packed__read_header_0(void) cl_assert(obj->raw.len == len); cl_assert(obj->raw.type == type); - git_odb_object_close(obj); + git_odb_object_free(obj); } } @@ -72,6 +72,7 @@ void test_odb_packed__read_header_1(void) cl_assert(obj->raw.len == len); cl_assert(obj->raw.type == type); - git_odb_object_close(obj); + git_odb_object_free(obj); } } + diff --git a/tests/t03-objwrite.c b/tests/t03-objwrite.c index 6cf3834c2..1fc0cac5e 100644 --- a/tests/t03-objwrite.c +++ b/tests/t03-objwrite.c @@ -113,7 +113,7 @@ BEGIN_TEST(write0, "write loose commit object") must_pass(git_odb_read(&obj, db, &id1)); must_pass(cmp_objects(&obj->raw, &commit_obj)); - git_odb_object_close(obj); + git_odb_object_free(obj); git_odb_free(db); must_pass(remove_object_files(&commit)); END_TEST @@ -134,7 +134,7 @@ BEGIN_TEST(write1, "write loose tree object") must_pass(git_odb_read(&obj, db, &id1)); must_pass(cmp_objects(&obj->raw, &tree_obj)); - git_odb_object_close(obj); + git_odb_object_free(obj); git_odb_free(db); must_pass(remove_object_files(&tree)); END_TEST @@ -155,7 +155,7 @@ BEGIN_TEST(write2, "write loose tag object") must_pass(git_odb_read(&obj, db, &id1)); must_pass(cmp_objects(&obj->raw, &tag_obj)); - git_odb_object_close(obj); + git_odb_object_free(obj); git_odb_free(db); must_pass(remove_object_files(&tag)); END_TEST @@ -176,7 +176,7 @@ BEGIN_TEST(write3, "write zero-length object") must_pass(git_odb_read(&obj, db, &id1)); must_pass(cmp_objects(&obj->raw, &zero_obj)); - git_odb_object_close(obj); + git_odb_object_free(obj); git_odb_free(db); must_pass(remove_object_files(&zero)); END_TEST @@ -197,7 +197,7 @@ BEGIN_TEST(write4, "write one-byte long object") must_pass(git_odb_read(&obj, db, &id1)); must_pass(cmp_objects(&obj->raw, &one_obj)); - git_odb_object_close(obj); + git_odb_object_free(obj); git_odb_free(db); must_pass(remove_object_files(&one)); END_TEST @@ -218,7 +218,7 @@ BEGIN_TEST(write5, "write two-byte long object") must_pass(git_odb_read(&obj, db, &id1)); must_pass(cmp_objects(&obj->raw, &two_obj)); - git_odb_object_close(obj); + git_odb_object_free(obj); git_odb_free(db); must_pass(remove_object_files(&two)); END_TEST @@ -239,7 +239,7 @@ BEGIN_TEST(write6, "write an object which is several bytes long") must_pass(git_odb_read(&obj, db, &id1)); must_pass(cmp_objects(&obj->raw, &some_obj)); - git_odb_object_close(obj); + git_odb_object_free(obj); git_odb_free(db); must_pass(remove_object_files(&some)); END_TEST diff --git a/tests/t04-commit.c b/tests/t04-commit.c index d0bb1b583..a0e6037e4 100644 --- a/tests/t04-commit.c +++ b/tests/t04-commit.c @@ -609,18 +609,18 @@ BEGIN_TEST(details0, "query the details on a parsed commit") must_be_true(parents <= 2); for (p = 0;p < parents;p++) { if (old_parent != NULL) - git_commit_close(old_parent); + git_commit_free(old_parent); old_parent = parent; must_pass(git_commit_parent(&parent, commit, p)); must_be_true(parent != NULL); must_be_true(git_commit_author(parent) != NULL); // is it really a commit? } - git_commit_close(old_parent); - git_commit_close(parent); + git_commit_free(old_parent); + git_commit_free(parent); must_fail(git_commit_parent(&parent, commit, parents)); - git_commit_close(commit); + git_commit_free(commit); } git_repository_free(repo); @@ -665,8 +665,8 @@ BEGIN_TEST(write0, "write a new commit object from memory to disk") tree, 1, parent)); - git_object_close((git_object *)parent); - git_object_close((git_object *)tree); + git_object_free((git_object *)parent); + git_object_free((git_object *)tree); git_signature_free(committer); git_signature_free(author); @@ -696,7 +696,7 @@ BEGIN_TEST(write0, "write a new commit object from memory to disk") must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)commit)); - git_commit_close(commit); + git_commit_free(commit); git_repository_free(repo); END_TEST @@ -742,7 +742,7 @@ BEGIN_TEST(root0, "create a root commit") tree, 0)); - git_object_close((git_object *)tree); + git_object_free((git_object *)tree); git_signature_free(committer); git_signature_free(author); @@ -764,7 +764,7 @@ BEGIN_TEST(root0, "create a root commit") must_pass(git_reference_delete(branch)); must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)commit)); git__free(head_old); - git_commit_close(commit); + git_commit_free(commit); git_repository_free(repo); git_reference_free(head); diff --git a/tests/t08-tag.c b/tests/t08-tag.c index 44efb584d..47d7be840 100644 --- a/tests/t08-tag.c +++ b/tests/t08-tag.c @@ -60,9 +60,9 @@ BEGIN_TEST(read0, "read and parse a tag from the repository") must_be_true(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0); - git_tag_close(tag1); - git_tag_close(tag2); - git_commit_close(commit); + git_tag_free(tag1); + git_tag_free(tag2); + git_commit_free(commit); git_repository_free(repo); END_TEST @@ -133,8 +133,8 @@ BEGIN_TEST(read3, "read and parse a tag without a tagger field") must_be_true(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0); - git_tag_close(bad_tag); - git_commit_close(commit); + git_tag_free(bad_tag); + git_commit_free(commit); git_repository_free(repo); END_TEST @@ -170,7 +170,7 @@ BEGIN_TEST(write0, "write a tag to the repository and read it again") TAGGER_MESSAGE, 0)); - git_object_close(target); + git_object_free(target); git_signature_free(tagger); must_pass(git_tag_lookup(&tag, repo, &tag_id)); @@ -195,7 +195,7 @@ BEGIN_TEST(write0, "write a tag to the repository and read it again") must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)tag)); - git_tag_close(tag); + git_tag_free(tag); git_repository_free(repo); END_TEST @@ -222,7 +222,7 @@ BEGIN_TEST(write2, "Attempt to write a tag bearing the same name than an already TAGGER_MESSAGE, 0)); - git_object_close(target); + git_object_free(target); git_signature_free(tagger); git_repository_free(repo); @@ -256,7 +256,7 @@ BEGIN_TEST(write3, "Replace an already existing tag") TAGGER_MESSAGE, 1)); - git_object_close(target); + git_object_free(target); git_signature_free(tagger); must_pass(git_reference_lookup(&ref_tag, repo, "refs/tags/e90810b")); @@ -286,7 +286,7 @@ BEGIN_TEST(write4, "write a lightweight tag to the repository and read it again" target, 0)); - git_object_close(target); + git_object_free(target); must_be_true(git_oid_cmp(&object_id, &target_id) == 0); @@ -320,7 +320,7 @@ BEGIN_TEST(write5, "Attempt to write a lightweight tag bearing the same name tha git_oid_fromstr(&existing_object_id, tag2_id); must_be_true(git_oid_cmp(&object_id, &existing_object_id) == 0); - git_object_close(target); + git_object_free(target); git_repository_free(repo); END_TEST diff --git a/tests/t09-tree.c b/tests/t09-tree.c index 2341a1ca4..8995b45ef 100644 --- a/tests/t09-tree.c +++ b/tests/t09-tree.c @@ -53,13 +53,13 @@ static int print_tree(git_repository *repo, const git_oid *tree_oid, int depth) if (entry->attr == S_IFDIR) { if (print_tree(repo, &entry->oid, depth + 1) < GIT_SUCCESS) { - git_tree_close(tree); + git_tree_free(tree); return GIT_ERROR; } } } - git_tree_close(tree); + git_tree_free(tree); return GIT_SUCCESS; } #endif @@ -83,7 +83,7 @@ BEGIN_TEST(read0, "acces randomly the entries on a loaded tree") must_be_true(git_tree_entry_byindex(tree, 3) == NULL); must_be_true(git_tree_entry_byindex(tree, (unsigned int)-1) == NULL); - git_tree_close(tree); + git_tree_free(tree); git_repository_free(repo); END_TEST @@ -105,7 +105,7 @@ BEGIN_TEST(read1, "read a tree from the repository") /* GH-86: git_object_lookup() should also check the type if the object comes from the cache */ must_be_true(git_object_lookup(&obj, repo, &id, GIT_OBJ_TREE) == 0); must_be_true(obj != NULL); - git_object_close(obj); + git_object_free(obj); obj = NULL; must_be_true(git_object_lookup(&obj, repo, &id, GIT_OBJ_BLOB) == GIT_EINVALIDTYPE); must_be_true(obj == NULL); @@ -118,8 +118,8 @@ BEGIN_TEST(read1, "read a tree from the repository") must_pass(git_tree_entry_2object(&obj, repo, entry)); must_be_true(obj != NULL); - git_object_close(obj); - git_tree_close(tree); + git_object_free(obj); + git_tree_free(tree); git_repository_free(repo); END_TEST @@ -164,7 +164,7 @@ BEGIN_TEST(write2, "write a tree from a memory") must_be_true(git_oid_cmp(&rid, &id2) == 0); git_treebuilder_free(builder); - git_tree_close(tree); + git_tree_free(tree); close_temp_repo(repo); END_TEST @@ -193,7 +193,7 @@ BEGIN_TEST(write3, "write a hierarchical tree from a memory") must_pass(git_treebuilder_insert(NULL,builder,"new",&subtree_id,040000)); must_pass(git_treebuilder_write(&id_hiearar,repo,builder)); git_treebuilder_free(builder); - git_tree_close(tree); + git_tree_free(tree); must_be_true(git_oid_cmp(&id_hiearar, &id3) == 0); @@ -204,7 +204,7 @@ BEGIN_TEST(write3, "write a hierarchical tree from a memory") must_be_true((loose_object_dir_mode(TEMP_REPO_FOLDER, (git_object *)tree) & 0777) == GIT_OBJECT_DIR_MODE); must_be_true((loose_object_mode(TEMP_REPO_FOLDER, (git_object *)tree) & 0777) == GIT_OBJECT_FILE_MODE); #endif - git_tree_close(tree); + git_tree_free(tree); close_temp_repo(repo); diff --git a/tests/t10-refs.c b/tests/t10-refs.c index e5e722992..b00ccfac6 100644 --- a/tests/t10-refs.c +++ b/tests/t10-refs.c @@ -54,7 +54,7 @@ BEGIN_TEST(readtag0, "lookup a loose tag reference") git_path_join(ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object)); must_be_true(strcmp(ref_name_from_tag_name, loose_tag_ref_name) == 0); - git_object_close(object); + git_object_free(object); git_repository_free(repo); git_reference_free(reference); @@ -99,7 +99,7 @@ BEGIN_TEST(readsym0, "lookup a symbolic reference") git_oid_fromstr(&id, current_master_tip); must_be_true(git_oid_cmp(&id, git_object_id(object)) == 0); - git_object_close(object); + git_object_free(object); git_repository_free(repo); git_reference_free(reference); @@ -129,7 +129,7 @@ BEGIN_TEST(readsym1, "lookup a nested symbolic reference") git_oid_fromstr(&id, current_master_tip); must_be_true(git_oid_cmp(&id, git_object_id(object)) == 0); - git_object_close(object); + git_object_free(object); git_repository_free(repo); git_reference_free(reference); @@ -200,7 +200,7 @@ BEGIN_TEST(readpacked0, "lookup a packed reference") must_be_true(object != NULL); must_be_true(git_object_type(object) == GIT_OBJ_COMMIT); - git_object_close(object); + git_object_free(object); git_repository_free(repo); git_reference_free(reference); |