Patchwork D2763: xdiff: remove unused flags parameter

login
register
mail settings
Submitter phabricator
Date March 9, 2018, 10:54 p.m.
Message ID <differential-rev-PHID-DREV-fsiroxhlredl6xvia7yq-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/29213/
State Superseded
Headers show

Comments

phabricator - March 9, 2018, 10:54 p.m.
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  After https://phab.mercurial-scm.org/D2683, the flags parameter in some functions is no longer needed.
  Thus removed.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2763

AFFECTED FILES
  mercurial/thirdparty/xdiff/xdiffi.c
  mercurial/thirdparty/xdiff/xprepare.c
  mercurial/thirdparty/xdiff/xutils.c
  mercurial/thirdparty/xdiff/xutils.h

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel
phabricator - March 9, 2018, 11:21 p.m.
indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  Strictly speaking, we might want to bump the C extension version number because of the ABI change. But I'm not sure if these functions are exported or even used by our C extension. So it may not matter. It's an experimental feature right now, so I'm inclined to not care.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2763

To: quark, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
phabricator - March 9, 2018, 11:31 p.m.
quark added a comment.


  I don't think the Python ".so"s should be consumed by non-Python "dlopen". So "version" doesn't change since Python API remains the same.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2763

To: quark, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/mercurial/thirdparty/xdiff/xutils.h b/mercurial/thirdparty/xdiff/xutils.h
--- a/mercurial/thirdparty/xdiff/xutils.h
+++ b/mercurial/thirdparty/xdiff/xutils.h
@@ -30,8 +30,8 @@ 
 void xdl_cha_free(chastore_t *cha);
 void *xdl_cha_alloc(chastore_t *cha);
 int64_t xdl_guess_lines(mmfile_t *mf, int64_t sample);
-int xdl_recmatch(const char *l1, int64_t s1, const char *l2, int64_t s2, int64_t flags);
-uint64_t xdl_hash_record(char const **data, char const *top, int64_t flags);
+int xdl_recmatch(const char *l1, int64_t s1, const char *l2, int64_t s2);
+uint64_t xdl_hash_record(char const **data, char const *top);
 unsigned int xdl_hashbits(unsigned int size);
 
 
diff --git a/mercurial/thirdparty/xdiff/xutils.c b/mercurial/thirdparty/xdiff/xutils.c
--- a/mercurial/thirdparty/xdiff/xutils.c
+++ b/mercurial/thirdparty/xdiff/xutils.c
@@ -121,14 +121,14 @@ 
 	return nl + 1;
 }
 
-int xdl_recmatch(const char *l1, int64_t s1, const char *l2, int64_t s2, int64_t flags)
+int xdl_recmatch(const char *l1, int64_t s1, const char *l2, int64_t s2)
 {
 	if (s1 == s2 && !memcmp(l1, l2, s1))
 		return 1;
 	return 0;
 }
 
-uint64_t xdl_hash_record(char const **data, char const *top, int64_t flags) {
+uint64_t xdl_hash_record(char const **data, char const *top) {
 	uint64_t ha = 5381;
 	char const *ptr = *data;
 
diff --git a/mercurial/thirdparty/xdiff/xprepare.c b/mercurial/thirdparty/xdiff/xprepare.c
--- a/mercurial/thirdparty/xdiff/xprepare.c
+++ b/mercurial/thirdparty/xdiff/xprepare.c
@@ -118,7 +118,7 @@ 
 	for (rcrec = cf->rchash[hi]; rcrec; rcrec = rcrec->next)
 		if (rcrec->ha == rec->ha &&
 				xdl_recmatch(rcrec->line, rcrec->size,
-					rec->ptr, rec->size, cf->flags))
+					rec->ptr, rec->size))
 			break;
 
 	if (!rcrec) {
@@ -273,7 +273,7 @@ 
 	if ((cur = blk = xdl_mmfile_first(mf, &bsize)) != NULL) {
 		for (top = blk + bsize; cur < top; ) {
 			prev = cur;
-			hav = xdl_hash_record(&cur, top, xpp->flags);
+			hav = xdl_hash_record(&cur, top);
 			if (nrec >= narec) {
 				narec *= 2;
 				if (!(rrecs = (xrecord_t **) xdl_realloc(recs, narec * sizeof(xrecord_t *))))
diff --git a/mercurial/thirdparty/xdiff/xdiffi.c b/mercurial/thirdparty/xdiff/xdiffi.c
--- a/mercurial/thirdparty/xdiff/xdiffi.c
+++ b/mercurial/thirdparty/xdiff/xdiffi.c
@@ -398,12 +398,11 @@ 
 }
 
 
-static int recs_match(xrecord_t *rec1, xrecord_t *rec2, int64_t flags)
+static int recs_match(xrecord_t *rec1, xrecord_t *rec2)
 {
 	return (rec1->ha == rec2->ha &&
 		xdl_recmatch(rec1->ptr, rec1->size,
-			     rec2->ptr, rec2->size,
-			     flags));
+			     rec2->ptr, rec2->size));
 }
 
 /*
@@ -762,10 +761,10 @@ 
  * 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, int64_t 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;
 
@@ -783,10 +782,10 @@ 
  * 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, int64_t 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;
 
@@ -847,7 +846,7 @@ 
 			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))
 					xdl_bug("group sync broken sliding up");
 
@@ -862,7 +861,7 @@ 
 
 			/* 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))
 					xdl_bug("group sync broken sliding down");
@@ -889,7 +888,7 @@ 
 			 * that it can align with.
 			 */
 			while (go.end == go.start) {
-				if (group_slide_up(xdf, &g, flags))
+				if (group_slide_up(xdf, &g))
 					xdl_bug("match disappeared");
 				if (group_previous(xdfo, &go))
 					xdl_bug("group sync broken sliding to match");
@@ -950,7 +949,7 @@ 
 			}
 
 			while (g.end > best_shift) {
-				if (group_slide_up(xdf, &g, flags))
+				if (group_slide_up(xdf, &g))
 					xdl_bug("best shift unreached");
 				if (group_previous(xdfo, &go))
 					xdl_bug("group sync broken sliding to blank line");