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

[PATCH 3/3] xdiff: drop unused flags parameter from recs_match

From
Jeff King <peff@peff.net>
Date
Dec 3, 2021, 05:12 UTC
Message-ID
<YamnIeXz+EscCTZC@coredump.intra.peff.net>
In-Reply-To
<Yammtm+pIkMu43zZ@coredump.intra.peff.net>

Since 6b13bc3232 (xdiff: simplify comparison, 2021-11-17), we do not call xdl_recmatch() from xdiffi.c's recs_match(), so we no longer need the "flags" parameter. That in turn lets us drop the flags parameters from the group-slide functions which call it.

There's no functional change here; it's just making these functions a little simpler.

Signed-off-by: Jeff King <peff@peff.net>
---
 xdiff/xdiffi.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c
index 6a3b9280be..69689fab24 100644
--- a/xdiff/xdiffi.c
+++ b/xdiff/xdiffi.c
@@ -390,7 +390,7 @@ static xdchange_t *xdl_add_change(xdchange_t *xscr, long i1, long i2, long chg1,
 }
 
 
-static int recs_match(xrecord_t *rec1, xrecord_t *rec2, long flags)
+static int recs_match(xrecord_t *rec1, xrecord_t *rec2)
 {
 	return (rec1->ha == rec2->ha);
 }
@@ -756,10 +756,10 @@ static inline int group_previous(xdfile_t *xdf, struct xdlgroup *g)
  * following group, expand this group to include it. Return 0 on success or -1
  * if g cannot be slid down.
  */
-static int group_slide_down(xdfile_t *xdf, struct xdlgroup *g, long flags)
+static int group_slide_down(xdfile_t *xdf, struct xdlgroup *g)
 {
 	if (g->end < xdf->nrec &&
-	    recs_match(xdf->recs[g->start], xdf->recs[g->end], flags)) {
+	    recs_match(xdf->recs[g->start], xdf->recs[g->end])) {
 		xdf->rchg[g->start++] = 0;
 		xdf->rchg[g->end++] = 1;
 
@@ -777,10 +777,10 @@ static int group_slide_down(xdfile_t *xdf, struct xdlgroup *g, long flags)
  * into a previous group, expand this group to include it. Return 0 on success
  * or -1 if g cannot be slid up.
  */
-static int group_slide_up(xdfile_t *xdf, struct xdlgroup *g, long flags)
+static int group_slide_up(xdfile_t *xdf, struct xdlgroup *g)
 {
 	if (g->start > 0 &&
-	    recs_match(xdf->recs[g->start - 1], xdf->recs[g->end - 1], flags)) {
+	    recs_match(xdf->recs[g->start - 1], xdf->recs[g->end - 1])) {
 		xdf->rchg[--g->start] = 1;
 		xdf->rchg[--g->end] = 0;
 
@@ -830,7 +830,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
 			end_matching_other = -1;
 
 			/* Shift the group backward as much as possible: */
-			while (!group_slide_up(xdf, &g, flags))
+			while (!group_slide_up(xdf, &g))
 				if (group_previous(xdfo, &go))
 					BUG("group sync broken sliding up");
 
@@ -845,7 +845,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
 
 			/* Now shift the group forward as far as possible: */
 			while (1) {
-				if (group_slide_down(xdf, &g, flags))
+				if (group_slide_down(xdf, &g))
 					break;
 				if (group_next(xdfo, &go))
 					BUG("group sync broken sliding down");
@@ -872,7 +872,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
 			 * other file that it can align with.
 			 */
 			while (go.end == go.start) {
-				if (group_slide_up(xdf, &g, flags))
+				if (group_slide_up(xdf, &g))
 					BUG("match disappeared");
 				if (group_previous(xdfo, &go))
 					BUG("group sync broken sliding to match");
@@ -915,7 +915,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
 			}
 
 			while (g.end > best_shift) {
-				if (group_slide_up(xdf, &g, flags))
+				if (group_slide_up(xdf, &g))
 					BUG("best shift unreached");
 				if (group_previous(xdfo, &go))
 					BUG("group sync broken sliding to blank line");
-- 
2.34.1.436.g8c445b282e
Previous: Jeff KingNext: Phillip Wood
Message 41 of 42 in “What's cooking in git.git (Nov 2021, #07; Mon, 29)”
  1. Junio C HamanoNov 30, 2021
  2. jk/loosen-urlmatch, was What's cooking in git.git (Nov 2021, #07; Mon, 29)Jeff King, Nov 30, 2021
  3. brian m. carlsonNov 30, 2021
  4. ab/run-command + em/missing-pager (was: What's cooking in git.git (Nov 2021, #07; Mon, 29))Ævar Arnfjörð Bjarmason, Nov 30, 2021
  5. Jeff KingNov 30, 2021
  6. Eric SunshineNov 30, 2021
  7. ab/ci-updates (was: What's cooking in git.git (Nov 2021, #07; Mon, 29))Ævar Arnfjörð Bjarmason, Nov 30, 2021
  8. ab/config-based-hooks-2 (was: What's cooking in git.git (Nov 2021, #07; Mon, 29))Ævar Arnfjörð Bjarmason, Nov 30, 2021
  9. fs/test-prereq (was: What's cooking in git.git (Nov 2021, #07; Mon, 29))Ævar Arnfjörð Bjarmason, Nov 30, 2021
  10. Fabian StelzerDec 1, 2021
  11. jc/c99-var-decl-in-for-loop (was: What's cooking in git.git (Nov 2021, #07; Mon, 29))Ævar Arnfjörð Bjarmason, Nov 30, 2021
  12. ns/tmp-objdir and ns/remerge-diffElijah Newren, Nov 30, 2021
  13. Junio C HamanoDec 3, 2021
  14. Neeraj SinghDec 4, 2021
  15. Elijah NewrenDec 4, 2021
  16. Elijah NewrenNov 30, 2021
  17. Victoria DyeDec 1, 2021
  18. Elijah NewrenNov 30, 2021
  19. Aleen 徐沛文Dec 1, 2021
  20. Elijah NewrenDec 1, 2021
  21. Ævar Arnfjörð BjarmasonDec 3, 2021
  22. Elijah NewrenDec 3, 2021
  23. Ævar Arnfjörð BjarmasonDec 3, 2021
  24. Aleen 徐沛文Dec 6, 2021
  25. Junio C HamanoDec 6, 2021
  26. Aleen 徐沛文Dec 6, 2021
  27. Aleen 徐沛文Dec 6, 2021
  28. Junio C HamanoDec 6, 2021
  29. Aleen 徐沛文Dec 7, 2021
  30. Junio C HamanoDec 7, 2021
  31. Aleen 徐沛文Dec 7, 2021
  32. Elijah NewrenDec 6, 2021
  33. Junio C HamanoDec 6, 2021
  34. en/zdiff3 (was: Re: What's cooking in git.git (Nov 2021, #07; Mon, 29))Elijah Newren, Nov 30, 2021
  35. Junio C HamanoDec 1, 2021
  36. Fabian StelzerDec 1, 2021
  37. Junio C HamanoDec 3, 2021
  38. 0/3 unused-parameter cleanups on top of pw/xdiff-classify-record-in-histogramJeff King, Dec 3, 2021
  39. 1/3 xdiff: drop CMP_ENV macro from xhistogramJeff King, Dec 3, 2021
  40. 2/3 xdiff: drop xpparam_t parameter from histogram cmp_recs()Jeff King, Dec 3, 2021
  41. 3/3 xdiff: drop unused flags parameter from recs_matchJeff King, Dec 3, 2021
  42. Phillip WoodDec 6, 2021

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.