Skip to content

xdiff: replace emit_func() with type-safe

René Scharfe git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5xdiff: add hunk_func()xdiff/xdiff.h xdiff/xdiffi.c+22 -00 replies
2/5blame: use hunk_func(), part 1builtin/blame.c+12 -50 replies
3/5blame: use hunk_func(), part 2builtin/blame.c+13 -50 replies
4/5blame: factor out helper for calling xdi_diff()builtin/blame.c+16 -220 replies
5/5xdiff: remove emit_func() and xdi_diff_hunks()xdiff-interface.c xdiff-interface.h xdiff/xdiff.h +1 more+1 -540 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] xdiff: replace emit_func() with type-safe

Commit ef2e62fe added the ability to bypass the creation of textual diffs and to access diff data directly, through the added emit_func member of xdemitconf_t. This function pointer has a type of "void (*)()", because "int (*)(xdfenv_t *, xdchange_t *, xdemitcb_t *, xdemitconf_t const *)" (its real type) would be difficult to export due to the many internal types in that signature.

This feature is currently used twice in git blame, through the function xdi_diff_hunks(). Both cases only need to know which lines are affected by the different hunks of a diff, i.e. the numbers shown in hunk headers of unified diffs.

This patch series adds a simpler mechanism to accommodate these two callers, in a type-safe way, without exporting too many internal types of libxdiff. The last patch removes the old functions.

xdiff: add hunk_func()
blame: use hunk_func(), part 1
blame: use hunk_func(), part 2
blame: factor out helper for calling xdi_diff()
xdiff: remove emit_func() and xdi_diff_hunks()

 builtin/blame.c   |   53 +++++++++++++++++++++++++++++++----------------------
 xdiff-interface.c |   44 --------------------------------------------
 xdiff-interface.h |    4 ----
 xdiff/xdiff.h     |    6 +++++-
 xdiff/xdiffi.c    |   17 +++++++++++++++--
 5 files changed, 51 insertions(+), 73 deletions(-)
Signature · 1 line
1.7.10.1