summaryrefslogtreecommitdiff
path: root/src/blob.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-03-12 23:09:16 +0200
committerVicent Marti <tanoku@gmail.com>2011-03-14 23:52:32 +0200
commit6b2a19418cb08e7bccefc2362f290a67555594a0 (patch)
tree44e666e45a50a59a444886b70c25c7c954d0ba4f /src/blob.c
parent005718280712634486a097427212e652b0e29f36 (diff)
downloadlibgit2-6b2a19418cb08e7bccefc2362f290a67555594a0.tar.gz
Fix the retarded object interdependency system
It's no longer retarded. All object interdependencies are stored as OIDs instead of actual objects. This should be hundreds of times faster, specially on big repositories. Heck, who knows, maye it doesn't even segfault -- wouldn't that be awesome? What has changed on the API? `git_commit_parent`, `git_commit_tree`, `git_tag_target` now return their values through a pointer-to-pointer, and have an error code. `git_commit_set_tree` and `git_tag_set_target` now return an error code and may fail. `git_repository_free__no_gc` has been deprecated because it's stupid. Since there are no longer any interdependencies between objects, we don't need internal reference counting, and GC never fails or double-free's pointers. `git_object_close` now does a very sane thing: marks an object as unused. Closed objects will be eventually free'd from the object cache based on LRU. Please use `git_object_close` from the garbage collector `destroy` method on your bindings. It's 100% safe. `git_repository_gc` is a new method that forces a garbage collector pass through the repo, to free as many LRU objects as possible. This is useful if we are running out of memory.
Diffstat (limited to 'src/blob.c')
-rw-r--r--src/blob.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/blob.c b/src/blob.c
index f157f4787..1e03b6b67 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -130,9 +130,7 @@ int git_blob_writefile(git_oid *written_id, git_repository *repo, const char *pa
git_oid_cpy(written_id, git_object_id((git_object *)blob));
- /* FIXME: maybe we don't want to free this already?
- * the user may want to access it again */
- GIT_OBJECT_DECREF(repo, blob);
+ git_object_close((git_object*)blob);
return GIT_SUCCESS;
}