diff options
| author | Patrick Steinhardt <ps@pks.im> | 2017-10-11 10:29:11 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2018-06-22 09:50:07 +0200 |
| commit | 4e8dc055b6ec0a960f112178e81b56c8b464fe8c (patch) | |
| tree | f0ca38d9d3c33c7e5a3ed7461d927791b07ab134 | |
| parent | e212011b9872c52f6205d3a30b10f753c3108918 (diff) | |
| download | libgit2-4e8dc055b6ec0a960f112178e81b56c8b464fe8c.tar.gz | |
pack-objects: make `git_walk_object` internal to pack-objects
The `git_walk_objects` structure is currently only being used inside of
the pack-objects.c file, but being declared in its header. This has
actually been the case since its inception in 04a36feff (pack-objects:
fill a packbuilder from a walk, 2014-10-11) and has never really
changed.
Move the struct declaration into pack-objects.c to improve code
encapsulation.
| -rw-r--r-- | src/pack-objects.c | 26 | ||||
| -rw-r--r-- | src/pack-objects.h | 6 |
2 files changed, 16 insertions, 16 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c index bc5fb2e1f..c12f25ea5 100644 --- a/src/pack-objects.c +++ b/src/pack-objects.c @@ -41,6 +41,12 @@ struct pack_write_context { git_transfer_progress *stats; }; +struct walk_object { + git_oid id; + unsigned int uninteresting:1, + seen:1; +}; + #ifdef GIT_THREADS #define GIT_PACKBUILDER__MUTEX_OP(pb, mtx, op) do { \ @@ -143,7 +149,7 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo) if (!pb->walk_objects) goto on_error; - git_pool_init(&pb->object_pool, sizeof(git_walk_object)); + git_pool_init(&pb->object_pool, sizeof(struct walk_object)); pb->repo = repo; pb->nr_threads = 1; /* do not spawn any thread by default */ @@ -1513,9 +1519,9 @@ size_t git_packbuilder_written(git_packbuilder *pb) return pb->nr_written; } -int lookup_walk_object(git_walk_object **out, git_packbuilder *pb, const git_oid *id) +static int lookup_walk_object(struct walk_object **out, git_packbuilder *pb, const git_oid *id) { - git_walk_object *obj; + struct walk_object *obj; obj = git_pool_mallocz(&pb->object_pool, 1); if (!obj) { @@ -1529,11 +1535,11 @@ int lookup_walk_object(git_walk_object **out, git_packbuilder *pb, const git_oid return 0; } -static int retrieve_object(git_walk_object **out, git_packbuilder *pb, const git_oid *id) +static int retrieve_object(struct walk_object **out, git_packbuilder *pb, const git_oid *id) { int error; khiter_t pos; - git_walk_object *obj; + struct walk_object *obj; pos = git_oidmap_lookup_index(pb->walk_objects, id); if (git_oidmap_valid_index(pb->walk_objects, pos)) { @@ -1552,7 +1558,7 @@ static int retrieve_object(git_walk_object **out, git_packbuilder *pb, const git static int mark_blob_uninteresting(git_packbuilder *pb, const git_oid *id) { int error; - git_walk_object *obj; + struct walk_object *obj; if ((error = retrieve_object(&obj, pb, id)) < 0) return error; @@ -1564,7 +1570,7 @@ static int mark_blob_uninteresting(git_packbuilder *pb, const git_oid *id) static int mark_tree_uninteresting(git_packbuilder *pb, const git_oid *id) { - git_walk_object *obj; + struct walk_object *obj; git_tree *tree; int error; size_t i; @@ -1636,7 +1642,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree) size_t i; int error; git_tree *subtree; - git_walk_object *obj; + struct walk_object *obj; const char *name; if ((error = retrieve_object(&obj, pb, git_tree_id(tree))) < 0) @@ -1684,7 +1690,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree) return error; } -int insert_commit(git_packbuilder *pb, git_walk_object *obj) +int insert_commit(git_packbuilder *pb, struct walk_object *obj) { int error; git_commit *commit = NULL; @@ -1714,7 +1720,7 @@ int git_packbuilder_insert_walk(git_packbuilder *pb, git_revwalk *walk) { int error; git_oid id; - git_walk_object *obj; + struct walk_object *obj; assert(pb && walk); diff --git a/src/pack-objects.h b/src/pack-objects.h index c9cd5777a..a931f3f86 100644 --- a/src/pack-objects.h +++ b/src/pack-objects.h @@ -52,12 +52,6 @@ typedef struct git_pobject { filled:1; } git_pobject; -typedef struct { - git_oid id; - unsigned int uninteresting:1, - seen:1; -} git_walk_object; - struct git_packbuilder { git_repository *repo; /* associated repository */ git_odb *odb; /* associated object database */ |
