Rename all `_close` methods There's no difference between `_free` and `_close` semantics: keep everything with the same name to avoid confusions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839
diff --git a/examples/general.c b/examples/general.c
index 8b58fa6..c67ff6f 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 b2a2b03..8b9380d 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 3c90e80..4e91b34 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 d82a71c..86a0a58 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 b99c40e..b144eca 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 bacb481..ced5ad5 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 63a5228..be49621 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 8ac8b16..fefd4c6 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 5fd0fd6..87f5686 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 12947f0..95c7cf9 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;
diff --git a/src/odb.c b/src/odb.c
index 9b72e7f..d31f93f 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -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 4c45fec..8931d5b 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 6477564..d632a19 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 d09abfd..97093a5 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;
}
diff --git a/src/tag.c b/src/tag.c
index fd79dc3..16d46ce 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -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 058ed7e..afc17e5 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 ec44d24..702095d 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 7d6f42d..06d08ac 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 756a157..1d53470 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 e50bca6..4e9918d 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 6cf3834..1fc0cac 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 d0bb1b5..a0e6037 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 44efb58..47d7be8 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 2341a1c..8995b45 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 e5e7229..b00ccfa 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);