diff options
| author | Patrick Steinhardt <ps@pks.im> | 2019-01-23 10:42:46 +0100 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2019-02-15 13:16:48 +0100 |
| commit | 351eeff3b2a666b8ead5302c1130629597438df6 (patch) | |
| tree | 5b494d3e5912949980fbbbb4945da4c2eb630aa1 /src/pack-objects.c | |
| parent | bda0839734bad8351e1dbc9c7beb8ae1f00d831e (diff) | |
| download | libgit2-351eeff3b2a666b8ead5302c1130629597438df6.tar.gz | |
maps: use uniform lifecycle management functions
Currently, the lifecycle functions for maps (allocation, deallocation, resize)
are not named in a uniform way and do not have a uniform function signature.
Rename the functions to fix that, and stick to libgit2's naming scheme of saying
`git_foo_new`. This results in the following new interface for allocation:
- `int git_<t>map_new(git_<t>map **out)` to allocate a new map, returning an
error code if we ran out of memory
- `void git_<t>map_free(git_<t>map *map)` to free a map
- `void git_<t>map_clear(git<t>map *map)` to remove all entries from a map
This commit also fixes all existing callers.
Diffstat (limited to 'src/pack-objects.c')
| -rw-r--r-- | src/pack-objects.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c index e1528646a..4ccc84d4b 100644 --- a/src/pack-objects.c +++ b/src/pack-objects.c @@ -141,12 +141,10 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo) pb = git__calloc(1, sizeof(*pb)); GIT_ERROR_CHECK_ALLOC(pb); - pb->object_ix = git_oidmap_alloc(); - if (!pb->object_ix) + if (git_oidmap_new(&pb->object_ix) < 0) goto on_error; - pb->walk_objects = git_oidmap_alloc(); - if (!pb->walk_objects) + if (git_oidmap_new(&pb->walk_objects) < 0) goto on_error; git_pool_init(&pb->object_pool, sizeof(struct walk_object)); |
