diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-02-18 22:57:53 +0300 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-03-03 21:23:49 +0300 |
commit | 86194b2433b993666bb58e7818f5b1f4133c9a43 (patch) | |
tree | c7165ed2c8d7f3bc291f49ef2d815ec29b24ac30 /src/vector.c | |
parent | 32054c24a26ab386fb56c7333fa723459e7e8dff (diff) |
Split packed from unpacked references
These two reference types are now stored separately to eventually allow
the removal/renaming of loose references and rewriting of the refs
packfile.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/vector.c')
-rw-r--r-- | src/vector.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/vector.c b/src/vector.c index 325f34306..e19497748 100644 --- a/src/vector.c +++ b/src/vector.c @@ -35,18 +35,13 @@ static int resize_vector(git_vector *v) void **new_contents; v->_alloc_size = ((unsigned int)(v->_alloc_size * resize_factor)) + 1; - if (v->_alloc_size == 0) + if (v->_alloc_size < minimum_size) v->_alloc_size = minimum_size; - new_contents = git__malloc(v->_alloc_size * sizeof(void *)); - if (new_contents == NULL) + v->contents = realloc(v->contents, v->_alloc_size * sizeof(void *)); + if (v->contents == NULL) return GIT_ENOMEM; - memcpy(new_contents, v->contents, v->length * sizeof(void *)); - - free(v->contents); - v->contents = new_contents; - return GIT_SUCCESS; } @@ -93,12 +88,6 @@ int git_vector_insert(git_vector *v, void *element) return GIT_SUCCESS; } -void *git_vector_get(git_vector *v, unsigned int position) -{ - assert(v); - return (position < v->length) ? v->contents[position] : NULL; -} - void git_vector_sort(git_vector *v) { assert(v); |