diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-03-01 02:37:28 +0300 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-03-03 21:23:53 +0300 |
commit | 584f49a5ceff463581f7f1b8bc23880dabca27ac (patch) | |
tree | a57c65fd2e530c2b096285c8625d62ea13685451 /src/repository.h | |
parent | 971c90befe4dfac4c235fa59d65f7e652fc27e1d (diff) |
Fix several issues with refcounting
- Added several missing reference increases
- Add new destructor to the repository that does not GC the objects
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/repository.h')
-rw-r--r-- | src/repository.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/repository.h b/src/repository.h index 2e8d187b0..4af062e97 100644 --- a/src/repository.h +++ b/src/repository.h @@ -15,8 +15,6 @@ #define GIT_OBJECTS_DIR "objects/" #define GIT_INDEX_FILE "index" -#define GIT_OBJECT_INCREF(ob) ++(((git_object *)(ob))->refcount) - typedef struct { git_rawobj raw; void *write_ptr; @@ -62,4 +60,12 @@ int git__source_write(git_odb_source *source, const void *bytes, size_t len); int git__parse_oid(git_oid *oid, char **buffer_out, const char *buffer_end, const char *header); int git__write_oid(git_odb_source *src, const char *header, const git_oid *oid); +#define GIT_OBJECT_INCREF(ob) git_object__incref((git_object *)(ob)) + +GIT_INLINE(void) git_object__incref(struct git_object *object) +{ + if (object) + object->refcount++; +} + #endif |