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

[PATCH 09/10] ref-filter: drop unused "obj" parameters

From
Jeff King <peff@peff.net>
Date
Feb 14, 2019, 05:50 UTC
Message-ID
<20190214055058.GI20578@sigill.intra.peff.net>
In-Reply-To
<20190214054736.GA20091@sigill.intra.peff.net>

The grab_person() and grab_sub_body_contents() functions take both an object struct and a buf/sz pair of the object bytes. However, they use only the latter, since "struct object" does not contain the parsed ident (nor the whole commit message, of course).

Let's get rid of these misleading "struct object" parameters. It's possible we may want them in the future (e.g., to generate error messages that mention the object id), but since these are static functions, we can easily add them back in later (and if we do want that information, it's likely we'd pass it through a more generalized "parsing context" struct anyway).

Signed-off-by: Jeff King <peff@peff.net>
---
 ref-filter.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/ref-filter.c b/ref-filter.c
index c9333b3181..9ba18b220c 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1064,7 +1064,7 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam
 }
 
 /* See grab_values */
-static void grab_person(const char *who, struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
+static void grab_person(const char *who, struct atom_value *val, int deref, void *buf, unsigned long sz)
 {
 	int i;
 	int wholen = strlen(who);
@@ -1192,7 +1192,7 @@ static void append_lines(struct strbuf *out, const char *buf, unsigned long size
 }
 
 /* See grab_values */
-static void grab_sub_body_contents(struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
+static void grab_sub_body_contents(struct atom_value *val, int deref, void *buf, unsigned long sz)
 {
 	int i;
 	const char *subpos = NULL, *bodypos = NULL, *sigpos = NULL;
@@ -1270,14 +1270,14 @@ static void grab_values(struct atom_value *val, int deref, struct object *obj, v
 	switch (obj->type) {
 	case OBJ_TAG:
 		grab_tag_values(val, deref, obj);
-		grab_sub_body_contents(val, deref, obj, buf, sz);
-		grab_person("tagger", val, deref, obj, buf, sz);
+		grab_sub_body_contents(val, deref, buf, sz);
+		grab_person("tagger", val, deref, buf, sz);
 		break;
 	case OBJ_COMMIT:
 		grab_commit_values(val, deref, obj);
-		grab_sub_body_contents(val, deref, obj, buf, sz);
-		grab_person("author", val, deref, obj, buf, sz);
-		grab_person("committer", val, deref, obj, buf, sz);
+		grab_sub_body_contents(val, deref, buf, sz);
+		grab_person("author", val, deref, buf, sz);
+		grab_person("committer", val, deref, buf, sz);
 		break;
 	case OBJ_TREE:
 		/* grab_tree_values(val, deref, obj, buf, sz); */
-- 
2.21.0.rc1.567.g648f076c3f
Previous: Jeff KingNext: Jeff King
Message 10 of 11 in “dropping more unused function parameters”
  1. 0/10 dropping more unused function parametersJeff King, Feb 14, 2019
  2. 01/10 diff: drop options parameter from diffcore_fix_diff_index()Jeff King, Feb 14, 2019
  3. 02/10 diff: drop unused color reset parametersJeff King, Feb 14, 2019
  4. 03/10 diff: drop unused emit data parameter from sane_truncate_line()Jeff King, Feb 14, 2019
  5. 04/10 diff: drop complete_rewrite parameter from run_external_diff()Jeff King, Feb 14, 2019
  6. 05/10 merge-recursive: drop several unused parametersJeff King, Feb 14, 2019
  7. 06/10 pack-objects: drop unused parameter from oe_map_new_pack()Jeff King, Feb 14, 2019
  8. 07/10 files-backend: drop refs parameter from split_symref_update()Jeff King, Feb 14, 2019
  9. 08/10 ref-filter: drop unused buf/sz pairsJeff King, Feb 14, 2019
  10. 09/10 ref-filter: drop unused "obj" parametersJeff King, Feb 14, 2019
  11. 10/10 ref-filter: drop unused "sz" parametersJeff King, Feb 14, 2019

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.