git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/7] index-pack: remove redundant parameter

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Aug 24, 2020, 19:16 UTC
Message-ID
<648ec34821bd435468a0917167bdeef7ca101c02.1598296530.git.jonathantanmy@google.com>
In-Reply-To
<cover.1598296530.git.jonathantanmy@google.com>

find_{ref,ofs}_delta_{,children} take an enum object_type parameter, but the object type is already present in the name of the function. Remove that parameter from these functions.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 builtin/index-pack.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index f865666db9..a8444d550b 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -614,7 +614,7 @@ static int compare_ofs_delta_bases(off_t offset1, off_t offset2,
 	       0;
 }
 
-static int find_ofs_delta(const off_t offset, enum object_type type)
+static int find_ofs_delta(const off_t offset)
 {
 	int first = 0, last = nr_ofs_deltas;
 
@@ -624,7 +624,8 @@ static int find_ofs_delta(const off_t offset, enum object_type type)
 		int cmp;
 
 		cmp = compare_ofs_delta_bases(offset, delta->offset,
-					      type, objects[delta->obj_no].type);
+					      OBJ_OFS_DELTA,
+					      objects[delta->obj_no].type);
 		if (!cmp)
 			return next;
 		if (cmp < 0) {
@@ -637,10 +638,9 @@ static int find_ofs_delta(const off_t offset, enum object_type type)
 }
 
 static void find_ofs_delta_children(off_t offset,
-				    int *first_index, int *last_index,
-				    enum object_type type)
+				    int *first_index, int *last_index)
 {
-	int first = find_ofs_delta(offset, type);
+	int first = find_ofs_delta(offset);
 	int last = first;
 	int end = nr_ofs_deltas - 1;
 
@@ -668,7 +668,7 @@ static int compare_ref_delta_bases(const struct object_id *oid1,
 	return oidcmp(oid1, oid2);
 }
 
-static int find_ref_delta(const struct object_id *oid, enum object_type type)
+static int find_ref_delta(const struct object_id *oid)
 {
 	int first = 0, last = nr_ref_deltas;
 
@@ -678,7 +678,8 @@ static int find_ref_delta(const struct object_id *oid, enum object_type type)
 		int cmp;
 
 		cmp = compare_ref_delta_bases(oid, &delta->oid,
-					      type, objects[delta->obj_no].type);
+					      OBJ_REF_DELTA,
+					      objects[delta->obj_no].type);
 		if (!cmp)
 			return next;
 		if (cmp < 0) {
@@ -691,10 +692,9 @@ static int find_ref_delta(const struct object_id *oid, enum object_type type)
 }
 
 static void find_ref_delta_children(const struct object_id *oid,
-				    int *first_index, int *last_index,
-				    enum object_type type)
+				    int *first_index, int *last_index)
 {
-	int first = find_ref_delta(oid, type);
+	int first = find_ref_delta(oid);
 	int last = first;
 	int end = nr_ref_deltas - 1;
 
@@ -983,12 +983,10 @@ static struct base_data *find_unresolved_deltas_1(struct base_data *base,
 {
 	if (base->ref_last == -1 && base->ofs_last == -1) {
 		find_ref_delta_children(&base->obj->idx.oid,
-					&base->ref_first, &base->ref_last,
-					OBJ_REF_DELTA);
+					&base->ref_first, &base->ref_last);
 
 		find_ofs_delta_children(base->obj->idx.offset,
-					&base->ofs_first, &base->ofs_last,
-					OBJ_OFS_DELTA);
+					&base->ofs_first, &base->ofs_last);
 
 		if (base->ref_last == -1 && base->ofs_last == -1) {
 			free(base->data);
-- 
2.28.0.297.g1956fa8f8d-goog
Previous: Jonathan TanNext: Junio C Hamano
Message 5 of 28 in “Better threaded delta resolution in index-pack (another try)”
  1. 0/7 Better threaded delta resolution in index-pack (another try)Jonathan Tan, Aug 24, 2020
  2. 1/7 Documentation: deltaBaseCacheLimit is per-threadJonathan Tan, Aug 24, 2020
  3. fetch-pack: in partial clone, pass --promisorJonathan Tan, Aug 24, 2020
  4. Jonathan TanAug 24, 2020
  5. 2/7 index-pack: remove redundant parameterJonathan Tan, Aug 24, 2020
  6. Junio C HamanoAug 24, 2020
  7. 3/7 index-pack: unify threaded and unthreaded codeJonathan Tan, Aug 24, 2020
  8. Junio C HamanoAug 24, 2020
  9. 5/7 index-pack: calculate {ref,ofs}_{first,last} earlyJonathan Tan, Aug 24, 2020
  10. 7/7 index-pack: make quantum of work smallerJonathan Tan, Aug 24, 2020
  11. Junio C HamanoAug 24, 2020
  12. 6/7 index-pack: make resolve_delta() assume base dataJonathan Tan, Aug 24, 2020
  13. 4/7 index-pack: remove redundant child fieldJonathan Tan, Aug 24, 2020
  14. Junio C HamanoAug 24, 2020
  15. fixup! index-pack: make quantum of work smallerJonathan Tan, Aug 24, 2020
  16. Jeff KingAug 24, 2020
  17. Jonathan TanAug 25, 2020
  18. Jeff KingAug 25, 2020
  19. Jeff KingAug 25, 2020
  20. 0/7 Better threaded delta resolution in index-pack (another try)Jonathan Tan, Sep 8, 2020
  21. 2/7 index-pack: remove redundant parameterJonathan Tan, Sep 8, 2020
  22. 3/7 index-pack: unify threaded and unthreaded codeJonathan Tan, Sep 8, 2020
  23. 7/7 index-pack: make quantum of work smallerJonathan Tan, Sep 8, 2020
  24. 6/7 index-pack: make resolve_delta() assume base dataJonathan Tan, Sep 8, 2020
  25. 5/7 index-pack: calculate {ref,ofs}_{first,last} earlyJonathan Tan, Sep 8, 2020
  26. 4/7 index-pack: remove redundant child fieldJonathan Tan, Sep 8, 2020
  27. 1/7 Documentation: deltaBaseCacheLimit is per-threadJonathan Tan, Sep 8, 2020
  28. Junio C HamanoSep 8, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.