Subject: [PATCH v3 00/10] Cleanup xdfile_t and xrecord_t in xdiff.

From: "Ezekiel Newren via GitGitGadget" <[email-masked]>
Date: Fri, 19 Sep 2025 15:16:22 +0000

Changes since v2.

 * No patch changes, just resending to get patch 9 to show up on the mailing
   list.
 * A few tweaks to the cover letter.

Changes since v1, to address review feedback.

 * Only include the clean up patches; The remaining patches will be split
   into a separate series.
 * Commit message clarifications.
 * Minor style cleanups.
 * Performance impacts included in commit message of patch 8.

Relevant part of the original cover letter follows:
===================================================

Before:

typedef struct s_xrecord {
	struct s_xrecord *next;
	char const *ptr;
	long size;
	unsigned long ha;
} xrecord_t;

typedef struct s_xdfile {
	chastore_t rcha;
	long nrec;
	unsigned int hbits;
	xrecord_t **rhash;
	long dstart, dend;
	xrecord_t **recs;
	char *rchg;
	long *rindex;
	long nreff;
	unsigned long *ha;
} xdfile_t;

After cleanup:

typedef struct s_xrecord {
	char const *ptr;
	long size;
	unsigned long ha;
} xrecord_t;

typedef struct s_xdfile {
	xrecord_t *recs;
	long nrec;
	long dstart, dend;
	char *rchg;
	long *rindex;
	long nreff;
} xdfile_t;

===

Ezekiel Newren (10):
  xdiff: delete static forward declarations in xprepare
  xdiff: delete local variables and initialize/free xdfile_t directly
  xdiff: delete unnecessary fields from xrecord_t and xdfile_t
  xdiff: delete xdl_get_rec() in xemit
  xdiff: delete struct diffdata_t
  xdiff: delete redundant array xdfile_t.ha
  xdiff: delete fields ha, line, size in xdlclass_t in favor of an
    xrecord_t
  xdiff: delete chastore from xdfile_t
  xdiff: delete rchg aliasing
  xdiff: treat xdfile_t.rchg like an enum

 xdiff/xdiff.h      |   4 +
 xdiff/xdiffi.c     | 101 ++++++++---------
 xdiff/xdiffi.h     |  11 +-
 xdiff/xemit.c      |  38 +++----
 xdiff/xhistogram.c |  10 +-
 xdiff/xmerge.c     |  56 +++++-----
 xdiff/xpatience.c  |  18 ++--
 xdiff/xprepare.c   | 262 +++++++++++++++++----------------------------
 xdiff/xtypes.h     |   7 +-
 xdiff/xutils.c     |  12 +--
 10 files changed, 212 insertions(+), 307 deletions(-)

base-commit: c44beea485f0f2feaf460e2ac87fdd5608d63cf0
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2048%2Fezekielnewren%2Fuse_rust_types_in_xdiff-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2048/ezekielnewren/use_rust_types_in_xdiff-v3
Pull-Request: https://github.com/git/git/pull/2048

Range-diff vs v2:

  1:  784cffcef5 =  1:  784cffcef5 xdiff: delete static forward declarations in xprepare
  2:  b79157e64f =  2:  b79157e64f xdiff: delete local variables and initialize/free xdfile_t directly
  3:  2e8de5be03 =  3:  2e8de5be03 xdiff: delete unnecessary fields from xrecord_t and xdfile_t
  4:  ddfee67e06 =  4:  ddfee67e06 xdiff: delete xdl_get_rec() in xemit
  5:  807ce3e5aa =  5:  807ce3e5aa xdiff: delete struct diffdata_t
  6:  0bacb1191d =  6:  0bacb1191d xdiff: delete redundant array xdfile_t.ha
  7:  e1e94107c9 =  7:  e1e94107c9 xdiff: delete fields ha, line, size in xdlclass_t in favor of an xrecord_t
  8:  fae26d2a04 =  8:  fae26d2a04 xdiff: delete chastore from xdfile_t
  9:  fd54135560 =  9:  fd54135560 xdiff: delete rchg aliasing
 10:  9a5ac3c488 = 10:  1e404c3290 xdiff: treat xdfile_t.rchg like an enum

-- 
gitgitgadget