From d25c00304cf6974a015b1efb87ddaf92d4b8f80c Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Thu, 30 Jul 2026 20:54:12 +0000 Subject: [PATCH] Remove the unused is_border_4() helper `thinr::is_border_4()` in src/thinr_common.h had no caller. Its last users were the stentiford and pavlidis kernels, dropped 2026-05-20. Verified before deleting: across src/, the symbol appears exactly once -- its own definition -- while its two neighbours in the same header, crossing_number() and neighbour_count(), have five references each. The package then compiles and passes 510 tests with the definition gone, which is the proof no caller existed. REVIEW-2026-07-28.md raised it and deliberately left the choice open, between deleting it and adding a comment stating it was retained on purpose. The unmerged review/no-consumer-audit branch took the second option. Taking the first instead, per the standing instruction that internal code does not get to carry tech debt: an uncalled helper with a comment explaining why it is uncalled is still a thing every reader has to evaluate, and git preserves it if a future kernel wants it back. The 8-neighbour vocabulary argument for keeping it does not survive contact with the file: the labelling convention lives in the header's own top comment, not in this function. Scope checked, not assumed: is_border_4 is the ONLY unused internal in the package. Every file-local C++ helper is called, and all nine .*_cpp Rcpp bindings are reached from R/ outside RcppExports. The CLAUDE.md line listing the header's shared helpers drops it too. REVIEW-2026-07-28.md keeps its mention -- it is a dated finding record, and this commit is the follow-up it asked for. Co-Authored-By: Claude Opus 5 --- CLAUDE.md | 2 +- NEWS.md | 6 ++++++ src/thinr_common.h | 6 ------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 8d561f4..b0d68cb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -43,7 +43,7 @@ C++ sources in `src/`: -- `thinr_common.h` — shared inline helpers (`crossing_number`, `neighbour_count`, `is_border_4`). +- `thinr_common.h` — shared inline helpers (`crossing_number`, `neighbour_count`). - `zhang_suen.cpp` — Zhang & Suen (1984). - `guo_hall.cpp` — Guo & Hall (1989). - `lee.cpp` — Lee, Kashyap & Chu (1994), 2-D adaptation. diff --git a/NEWS.md b/NEWS.md index 97eb5c9..44772f8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,12 @@ * Development version bump following the 0.3.0 CRAN release. +* Internal, with no change to any output: the unused `thinr::is_border_4()` + helper was removed from `src/thinr_common.h`. Its last callers were the + stentiford and pavlidis kernels, dropped 2026-05-20; nothing has referenced + it since. The header now declares only the two helpers that are actually + used. + * Internal, with no change to any output: the Zhang-Suen crossing number `A(p)` and neighbour count `B(p)` were re-implemented inline in `src/zhang_suen.cpp`, `src/lee.cpp`, and `src/holt.cpp` instead of calling diff --git a/src/thinr_common.h b/src/thinr_common.h index ed529b1..1786037 100644 --- a/src/thinr_common.h +++ b/src/thinr_common.h @@ -29,12 +29,6 @@ inline int neighbour_count(int p2, int p3, int p4, int p5, return p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9; } -// 4-connected background test: TRUE iff at least one 4-connected -// neighbour is background. Used to identify border pixels. -inline bool is_border_4(int p2, int p4, int p6, int p8) { - return (p2 == 0) || (p4 == 0) || (p6 == 0) || (p8 == 0); -} - } // namespace thinr #endif // THINR_COMMON_H