Subject: [PATCH 0/9] Xdiff cleanup part2

From: "Ezekiel Newren via GitGitGadget" <[email-masked]>
Date: Wed, 15 Oct 2025 21:18:12 +0000

Maintainer note: This patch series builds on top of en/xdiff-cleanup and
am/xdiff-hash-tweak (both of which are now in master).

The primary goal of this patch series is to convert every field's type in
xrecord_t and xdfile_t to be unambiguous, in preparation to make it more
Rust FFI friendly. Additionally the ha field in xrecord_t is split into
line_hash and minimal_perfect hash.

The order of some of the fields has changed as called out by the commit
messages.

Before:

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;
	bool *changed;
	long *rindex;
	long nreff;
} xdfile_t;

After part 2

typedef struct s_xrecord {
	uint8_t const *ptr;
	size_t size;
	uint64_t line_hash;
	size_t minimal_perfect_hash;
} xrecord_t;

typedef struct s_xdfile {
	xrecord_t *recs;
	size_t nrec;
	bool *changed;
	size_t *reference_index;
	size_t nreff;
	ssize_t dstart, dend;
} xdfile_t;

Ezekiel Newren (9):
  xdiff: use ssize_t for dstart/dend, make them last in xdfile_t
  xdiff: make xrecord_t.ptr a uint8_t instead of char
  xdiff: use size_t for xrecord_t.size
  xdiff: use unambiguous types in xdl_hash_record()
  xdiff: split xrecord_t.ha into line_hash and minimal_perfect_hash
  xdiff: make xdfile_t.nrec a size_t instead of long
  xdiff: make xdfile_t.nreff a size_t instead of long
  xdiff: change rindex from long to size_t in xdfile_t
  xdiff: rename rindex -> reference_index

 xdiff-interface.c  |  2 +-
 xdiff/xdiffi.c     | 29 +++++++++++------------
 xdiff/xemit.c      | 28 +++++++++++-----------
 xdiff/xhistogram.c |  4 ++--
 xdiff/xmerge.c     | 30 ++++++++++++------------
 xdiff/xpatience.c  | 14 +++++------
 xdiff/xprepare.c   | 58 +++++++++++++++++++++++-----------------------
 xdiff/xtypes.h     | 15 ++++++------
 xdiff/xutils.c     | 32 ++++++++++++-------------
 xdiff/xutils.h     |  6 ++---
 10 files changed, 109 insertions(+), 109 deletions(-)

base-commit: 143f58ef7535f8f8a80d810768a18bdf3807de26
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2070%2Fezekielnewren%2Fxdiff_cleanup_part2-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2070/ezekielnewren/xdiff_cleanup_part2-v1
Pull-Request: https://github.com/git/git/pull/2070
-- 
gitgitgadget