[gentoo-commits] repo/gentoo:master commit in: sys-apps/diffutils/files/, sys-apps/diffutils/
commit: 675f20bce1d8ec148072e6447dc4a365d2c9936a Author: Sam James gentoo org> AuthorDate: Sun Feb 12 06:18:03 2023 + Commit: Sam James gentoo org> CommitDate: Sun Feb 12 06:18:03 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=675f20bc sys-apps/diffutils: backport regression fix for -D This also fixes the groff tests. Signed-off-by: Sam James gentoo.org> sys-apps/diffutils/diffutils-3.9-r1.ebuild | 58 ++ .../diffutils-3.9-diff-D-option-regression.patch | 27 ++ 2 files changed, 85 insertions(+) diff --git a/sys-apps/diffutils/diffutils-3.9-r1.ebuild b/sys-apps/diffutils/diffutils-3.9-r1.ebuild new file mode 100644 index ..b33f99dcdb75 --- /dev/null +++ b/sys-apps/diffutils/diffutils-3.9-r1.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/diffutils.asc +inherit flag-o-matic verify-sig + +DESCRIPTION="Tools to make diffs and compare files" +HOMEPAGE="https://www.gnu.org/software/diffutils/; + +if [[ ${PV} == *_p* ]] ; then + # Subscribe to the 'platform-testers' ML to find these. + # Useful to test on our especially more niche arches and report issues upstream. + MY_COMMIT="43-2d50" + MY_P=${PN}-$(ver_cut 1-2).${MY_COMMIT} + SRC_URI="https://meyering.net/diff/${MY_P}.tar.xz; + SRC_URI+=" verify-sig? ( https://meyering.net/diff/${MY_P}.tar.xz.sig )" + S="${WORKDIR}"/${MY_P} +else + SRC_URI="mirror://gnu/${PN}/${P}.tar.xz" + SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +fi + +LICENSE="GPL-2" +SLOT="0" +IUSE="nls static" + +BDEPEND=" + nls? ( sys-devel/gettext ) + verify-sig? ( sec-keys/openpgp-keys-diffutils ) +" + +PATCHES=( + "${FILESDIR}"/${P}-make-4.4-test-color.patch + "${FILESDIR}"/${P}-diff-D-option-regression.patch +) + +src_configure() { + use static && append-ldflags -static + + # Disable automagic dependency over libsigsegv; see bug #312351. + export ac_cv_libsigsegv=no + + # required for >=glibc-2.26, bug #653914 + use elibc_glibc && export gl_cv_func_getopt_gnu=yes + + local myeconfargs=( + # Interferes with F_S (sets F_S=2) + --disable-gcc-warnings + --with-packager="Gentoo" + --with-packager-version="${PVR}" + --with-packager-bug-reports="https://bugs.gentoo.org/; + $(use_enable nls) + ) + econf "${myeconfargs[@]}" +} diff --git a/sys-apps/diffutils/files/diffutils-3.9-diff-D-option-regression.patch b/sys-apps/diffutils/files/diffutils-3.9-diff-D-option-regression.patch new file mode 100644 index ..a12e1bc673a0 --- /dev/null +++ b/sys-apps/diffutils/files/diffutils-3.9-diff-D-option-regression.patch @@ -0,0 +1,27 @@ +https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61193 +https://git.savannah.gnu.org/cgit/groff.git/commit/?id=10274fb69e517b2c4b10fcd0ba3347e5bd0eefd7 +https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=ba08fbbb0ca5da455bf695236c57bc50e7faed50 + +From ba08fbbb0ca5da455bf695236c57bc50e7faed50 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Fri, 10 Feb 2023 15:33:40 -0800 +Subject: diff: fix bug where -D does not work +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Problem reported by Robert Webb (bug#61193). +* src/diff.c (main): Omit stray ‘sizeof’. +* tests/ifdef: New test. +* tests/Makefile.am (TESTS): Add it. +--- a/src/diff.c b/src/diff.c +@@ -416,7 +416,7 @@ main (int argc, char **argv) + char *base = b; + int changes = 0; + +- for (i = 0; i < sizeof sizeof C_ifdef_group_formats; i++) ++ for (i = 0; i < sizeof C_ifdef_group_formats; i++) + { + char ch = C_ifdef_group_formats[i]; + switch (ch)
[gentoo-commits] repo/gentoo:master commit in: sys-apps/diffutils/files/, sys-apps/diffutils/
commit: cc023c47f0a30174d43fb940109fce5781edda95 Author: Sam James gentoo org> AuthorDate: Sun Jan 29 07:32:40 2023 + Commit: Sam James gentoo org> CommitDate: Sun Jan 29 07:33:13 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc023c47 sys-apps/diffutils: fix tests w/ make 4.4 Closes: https://bugs.gentoo.org/879891 Signed-off-by: Sam James gentoo.org> sys-apps/diffutils/diffutils-3.9.ebuild| 10 ++-- .../files/diffutils-3.9-make-4.4-test-color.patch | 30 ++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/sys-apps/diffutils/diffutils-3.9.ebuild b/sys-apps/diffutils/diffutils-3.9.ebuild index ebbd0424d186..acce50bad293 100644 --- a/sys-apps/diffutils/diffutils-3.9.ebuild +++ b/sys-apps/diffutils/diffutils-3.9.ebuild @@ -27,8 +27,14 @@ LICENSE="GPL-2" SLOT="0" IUSE="nls static" -BDEPEND="nls? ( sys-devel/gettext ) - verify-sig? ( sec-keys/openpgp-keys-diffutils )" +BDEPEND=" + nls? ( sys-devel/gettext ) + verify-sig? ( sec-keys/openpgp-keys-diffutils ) +" + +PATCHES=( + "${FILESDIR}"/${P}-make-4.4-test-color.patch +) src_configure() { use static && append-ldflags -static diff --git a/sys-apps/diffutils/files/diffutils-3.9-make-4.4-test-color.patch b/sys-apps/diffutils/files/diffutils-3.9-make-4.4-test-color.patch new file mode 100644 index ..01f6aeedc956 --- /dev/null +++ b/sys-apps/diffutils/files/diffutils-3.9-make-4.4-test-color.patch @@ -0,0 +1,30 @@ +https://bugs.gentoo.org/879891 +https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59905 +https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=89f3daeaaf021a77177daec8666bcd80ec476833 + +From 89f3daeaaf021a77177daec8666bcd80ec476833 Mon Sep 17 00:00:00 2001 +From: Jim Meyering +Date: Mon, 16 Jan 2023 15:48:10 -0800 +Subject: tests: accommodate newer GNU make's SIGPIPE-ignore +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* tests/colors: Allow an exit code of not just 141 (SIGPIPE), +but also "error": 2. +Reported by Tomasz Kłoczko in http://bugs.gnu.org/59905. +--- a/tests/colors b/tests/colors +@@ -128,6 +128,9 @@ printf '%100s-a' > a + printf '%100s-b' > b + head -c 10 < fifo > /dev/null & + diff --color=always ---presume-output-tty a b > fifo +-test $? = 141 || fail=1 ++ ++# Depending on version of GNU make (4.3.92-4.4 set SIGPIPE to "ignore"), ++# either of these is acceptable. ++case $? in 2|141) ;; *) fail=1 ;; esac + + Exit $fail +-- +cgit v1.1
[gentoo-commits] repo/gentoo:master commit in: sys-apps/diffutils/files/, sys-apps/diffutils/
commit: 1bff2846eaa16d29f9c023508d855931a727eebd Author: WANG Xuerui gentoo org> AuthorDate: Mon Apr 25 04:10:31 2022 + Commit: WANG Xuerui gentoo org> CommitDate: Mon Apr 25 10:10:46 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1bff2846 sys-apps/diffutils: fix build on loong Upstream has updated gnulib but hasn't tagged a new release yet, so only add the bare minimum to fix build on loong. This has been inside loongson-overlay for a while, and is tested on real loong hardware. See: https://github.com/gentoo/gentoo/pull/25189 Acked-by: Andreas K. Hüttel gentoo.org> Signed-off-by: WANG Xuerui gentoo.org> sys-apps/diffutils/diffutils-3.8.ebuild| 5 - sys-apps/diffutils/files/loong-fix-build.patch | 26 ++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/sys-apps/diffutils/diffutils-3.8.ebuild b/sys-apps/diffutils/diffutils-3.8.ebuild index df2a985392fb..53a9433ee899 100644 --- a/sys-apps/diffutils/diffutils-3.8.ebuild +++ b/sys-apps/diffutils/diffutils-3.8.ebuild @@ -23,7 +23,10 @@ IUSE="nls static" BDEPEND="nls? ( sys-devel/gettext ) verify-sig? ( sec-keys/openpgp-keys-diffutils )" -PATCHES=( "${FILESDIR}/ppc-musl.patch" ) +PATCHES=( + "${FILESDIR}/ppc-musl.patch" + "${FILESDIR}/loong-fix-build.patch" +) src_configure() { use static && append-ldflags -static diff --git a/sys-apps/diffutils/files/loong-fix-build.patch b/sys-apps/diffutils/files/loong-fix-build.patch new file mode 100644 index ..cd06fa8df5e4 --- /dev/null +++ b/sys-apps/diffutils/files/loong-fix-build.patch @@ -0,0 +1,26 @@ +From 34add045fd2ec3f1031dee961c4d9cc4285486a7 Mon Sep 17 00:00:00 2001 +From: Sun Haiyong +Date: Tue, 31 Aug 2021 11:11:52 +0800 +Subject: [PATCH] stack-direction: Add support for loongarch CPU + +* m4/stack-direction.m4 (SV_STACK_DIRECTION): When the CPU is loongarch, +set "sv_cv_stack_direction" to "-1" . +--- + m4/stack-direction.m4 | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/m4/stack-direction.m4 b/m4/stack-direction.m4 +index 93287254b..e6c3284ce 100644 +--- a/m4/stack-direction.m4 b/m4/stack-direction.m4 +@@ -32,6 +32,7 @@ AC_DEFUN([SV_STACK_DIRECTION], + i?86 | x86_64 | \ + i860 | \ + ia64 | \ ++ loongarch* | \ + m32r | \ + m68* | \ + m88k | \ +-- +2.17.2 +
[gentoo-commits] repo/gentoo:master commit in: sys-apps/diffutils/files/
commit: 9712b59e08cf0e003059846b82c88e6bd3404bfb Author: Sam James gentoo org> AuthorDate: Sun Mar 13 22:23:00 2022 + Commit: Sam James gentoo org> CommitDate: Sun Mar 13 22:23:26 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9712b59e sys-apps/diffutils: add link to upstream gnulib/musl/ppc patch Signed-off-by: Sam James gentoo.org> sys-apps/diffutils/files/ppc-musl.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys-apps/diffutils/files/ppc-musl.patch b/sys-apps/diffutils/files/ppc-musl.patch index d7d8255a444a..4aff0ba1cf5c 100644 --- a/sys-apps/diffutils/files/ppc-musl.patch +++ b/sys-apps/diffutils/files/ppc-musl.patch @@ -1,7 +1,8 @@ -Needed to fix build on ppc + musl. Doesn't seem to yet be in upstream gnulib. +Needed to fix build on ppc + musl. Should pop up in next gnulib sync in release (different patch). https://www.openwall.com/lists/musl/2017/11/05/2 https://github.com/void-linux/void-packages/blob/master/srcpkgs/grep/patches/ppc-musl.patch +https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=2d830e4a792fcd9f614ed08a7f18584b8b21d23b --- a/lib/sigsegv.c +++ b/lib/sigsegv.c @@ -221,8 +221,10 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
[gentoo-commits] repo/gentoo:master commit in: sys-apps/diffutils/files/
commit: 31d29b0723e754bf792a078f799a1bd8ddc5078c Author: Sam James gentoo org> AuthorDate: Wed Nov 17 04:33:33 2021 + Commit: Sam James gentoo org> CommitDate: Wed Nov 17 04:34:03 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31d29b07 sys-apps/diffutils: add links to musl patch Signed-off-by: Sam James gentoo.org> sys-apps/diffutils/files/ppc-musl.patch | 4 1 file changed, 4 insertions(+) diff --git a/sys-apps/diffutils/files/ppc-musl.patch b/sys-apps/diffutils/files/ppc-musl.patch index 6ba37f233591..d7d8255a444a 100644 --- a/sys-apps/diffutils/files/ppc-musl.patch +++ b/sys-apps/diffutils/files/ppc-musl.patch @@ -1,3 +1,7 @@ +Needed to fix build on ppc + musl. Doesn't seem to yet be in upstream gnulib. + +https://www.openwall.com/lists/musl/2017/11/05/2 +https://github.com/void-linux/void-packages/blob/master/srcpkgs/grep/patches/ppc-musl.patch --- a/lib/sigsegv.c +++ b/lib/sigsegv.c @@ -221,8 +221,10 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
[gentoo-commits] repo/gentoo:master commit in: sys-apps/diffutils/files/, sys-apps/diffutils/
commit: 03757f59d10a55b3b97676aeb02ab9e1f1365aec Author: Georgy Yakovlev gentoo org> AuthorDate: Wed Nov 17 02:38:47 2021 + Commit: Georgy Yakovlev gentoo org> CommitDate: Wed Nov 17 02:39:07 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03757f59 sys-apps/diffutils: add ppc32 musl patch Signed-off-by: Georgy Yakovlev gentoo.org> sys-apps/diffutils/diffutils-3.8.ebuild | 2 ++ sys-apps/diffutils/files/ppc-musl.patch | 14 ++ 2 files changed, 16 insertions(+) diff --git a/sys-apps/diffutils/diffutils-3.8.ebuild b/sys-apps/diffutils/diffutils-3.8.ebuild index fc7ab80b4a3b..4cae3d13edc4 100644 --- a/sys-apps/diffutils/diffutils-3.8.ebuild +++ b/sys-apps/diffutils/diffutils-3.8.ebuild @@ -17,6 +17,8 @@ IUSE="nls static" BDEPEND="nls? ( sys-devel/gettext )" +PATCHES=( "${FILESDIR}/ppc-musl.patch" ) + src_configure() { use static && append-ldflags -static diff --git a/sys-apps/diffutils/files/ppc-musl.patch b/sys-apps/diffutils/files/ppc-musl.patch new file mode 100644 index ..6ba37f233591 --- /dev/null +++ b/sys-apps/diffutils/files/ppc-musl.patch @@ -0,0 +1,14 @@ +--- a/lib/sigsegv.c b/lib/sigsegv.c +@@ -221,8 +221,10 @@ int libsigsegv_version = LIBSIGSEGV_VERSION; + /* both should be equivalent */ + # if 0 + #define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.regs->gpr[1] +-# else ++# elif defined(__GLIBC__) + #define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1] ++# else ++#define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[1] + # endif + # endif +
[gentoo-commits] repo/gentoo:master commit in: sys-apps/diffutils/files/
commit: 2bcf6d23ea329e863c2431f5f0098769f6d144c4 Author: Michael Mair-Keimberger gmail com> AuthorDate: Mon Jan 7 15:09:10 2019 + Commit: Lars Wendler gentoo org> CommitDate: Mon Jan 21 11:37:42 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2bcf6d23 sys-apps/diffutils: remove unused patch(es) Signed-off-by: Michael Mair-Keimberger gmail.com> Closes: https://github.com/gentoo/gentoo/pull/10763 Signed-off-by: Lars Wendler gentoo.org> .../diffutils/files/diffutils-3.5-fix_macros.patch| 19 --- 1 file changed, 19 deletions(-) diff --git a/sys-apps/diffutils/files/diffutils-3.5-fix_macros.patch b/sys-apps/diffutils/files/diffutils-3.5-fix_macros.patch deleted file mode 100644 index ae820fc372c..000 --- a/sys-apps/diffutils/files/diffutils-3.5-fix_macros.patch +++ /dev/null @@ -1,19 +0,0 @@ -http://git.savannah.gnu.org/cgit/gnulib.git/commit/lib/intprops.h?id=175b4e22f99e00996b72f822f5ae54dca8243d19 - diffutils-3.5/lib/intprops.h -+++ diffutils-3.5/lib/intprops.h -@@ -230,11 +230,11 @@ -(e.g., A and B) have the same type as MIN and MAX. Instead, they assume -that the result (e.g., A + B) has that type. */ - #if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL --# define _GL_ADD_OVERFLOW(a, b, min, max) -+# define _GL_ADD_OVERFLOW(a, b, min, max) \ -__builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0) --# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) -+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ -__builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0) --# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) -+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ -__builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0) - #else - # define _GL_ADD_OVERFLOW(a, b, min, max)\
[gentoo-commits] repo/gentoo:master commit in: sys-apps/diffutils/files/, sys-apps/diffutils/
commit: 0ac0d1883b2fbb34f8b85995cf2ce651af4ef006 Author: Lars Wendler gentoo org> AuthorDate: Mon Aug 15 19:55:04 2016 + Commit: Lars Wendler gentoo org> CommitDate: Mon Aug 15 19:55:18 2016 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ac0d188 sys-apps/diffutils: Revbump to fix use-after-free bug in diff3 (bug #591044). Package-Manager: portage-2.3.0 Signed-off-by: Lars Wendler gentoo.org> sys-apps/diffutils/diffutils-3.4-r1.ebuild | 50 + .../files/diffutils-3.4-diff3_fix_leaks.patch | 123 + .../files/diffutils-3.4-diff3_use_after_free.patch | 26 + .../diffutils-3.4-no_color_on_dumb_terms.patch | 49 4 files changed, 248 insertions(+) diff --git a/sys-apps/diffutils/diffutils-3.4-r1.ebuild b/sys-apps/diffutils/diffutils-3.4-r1.ebuild new file mode 100644 index 000..43a9069 --- /dev/null +++ b/sys-apps/diffutils/diffutils-3.4-r1.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +inherit flag-o-matic + +DESCRIPTION="Tools to make diffs and compare files" +HOMEPAGE="https://www.gnu.org/software/diffutils/; +SRC_URI="mirror://gnu-alpha/diffutils/${P}.tar.xz + mirror://gnu/diffutils/${P}.tar.xz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="nls static" + +DEPEND="app-arch/xz-utils + nls? ( sys-devel/gettext )" + +DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO ) + +PATCHES=( + "${FILESDIR}/${P}-no_color_on_dumb_terms.patch" + "${FILESDIR}/${P}-diff3_use_after_free.patch" + "${FILESDIR}/${P}-diff3_fix_leaks.patch" +) + +src_prepare() { + epatch "${PATCHES[@]}" +} + +src_configure() { + use static && append-ldflags -static + + # Disable automagic dependency over libsigsegv; see bug #312351. + export ac_cv_libsigsegv=no + + econf \ + --with-packager="Gentoo" \ + --with-packager-version="${PVR}" \ + --with-packager-bug-reports="https://bugs.gentoo.org/; \ + $(use_enable nls) +} + +src_test() { + # explicitly allow parallel testing + emake check +} diff --git a/sys-apps/diffutils/files/diffutils-3.4-diff3_fix_leaks.patch b/sys-apps/diffutils/files/diffutils-3.4-diff3_fix_leaks.patch new file mode 100644 index 000..fda8319 --- /dev/null +++ b/sys-apps/diffutils/files/diffutils-3.4-diff3_fix_leaks.patch @@ -0,0 +1,123 @@ +From edd942ca27d570a33d612b12eecaa33a76640e46 Mon Sep 17 00:00:00 2001 +From: Jim Meyering+Date: Fri, 12 Aug 2016 21:40:29 -0700 +Subject: diff3: fix leaks, for real + +* src/diff3.c (struct diff_block)[lint]: Add member, n2. +(free_diff_block, next_to_n2): New functions. +--- + +diff --git a/src/diff3.c b/src/diff3.c +index 0eb643e..b80aeb3 100644 +--- a/src/diff3.c b/src/diff3.c +@@ -78,6 +78,9 @@ struct diff_block { + char **lines[2];/* The actual lines (may contain nulls) */ + size_t *lengths[2]; /* Line lengths (including newlines, if any) */ + struct diff_block *next; ++#ifdef lint ++ struct diff_block *n2; /* Used only when freeing. */ ++#endif + }; + + /* Three way diff */ +@@ -176,7 +179,7 @@ static struct diff3_block *create_diff3_block (lin, lin, lin, lin, lin, lin); + static struct diff3_block *make_3way_diff (struct diff_block *, struct diff_block *); + static struct diff3_block *reverse_diff3_blocklist (struct diff3_block *); + static struct diff3_block *using_to_diff3_block (struct diff_block *[2], struct diff_block *[2], int, int, struct diff3_block const *); +-static struct diff_block *process_diff (char const *, char const *, struct diff_block **); ++static struct diff_block *process_diff (char const *, char const *, struct diff_block **, char **); + static void check_stdout (void); + static void fatal (char const *) __attribute__((noreturn)); + static void output_diff3 (FILE *, struct diff3_block *, int const[3], int const[3]); +@@ -212,6 +215,38 @@ static struct option const longopts[] = + {0, 0, 0, 0} + }; + ++static void ++free_diff_block (struct diff_block *p) ++{ ++#ifndef lint ++ (void)p; ++#else ++ while (p) ++{ ++ free (p->lines[0]); ++ free (p->lines[1]); ++ free (p->lengths[0]); ++ free (p->lengths[1]); ++ struct diff_block *next = p->n2; ++ free (p); ++ p = next; ++} ++#endif ++} ++ ++/* Copy each next pointer to n2, since make_3way_diff would clobber the former, ++ yet we will still need something to free these buffers. */ ++static void ++next_to_n2 (struct diff_block *p) ++{