gbranden pushed a commit to branch master
in repository groff.
commit 14b91955baa2eddccf5c4c3aef5bd6c24429648b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu May 21 19:57:57 2026 -0500
src/roff/troff/env.cpp: Refactor.
* src/roff/troff/env.cpp (add_hyphenation_exception_words_request):
Convert `while` loop to `do-while` loop. (1) We already know at first
loop entry that the condition is true and (2) structuring it this way
makes more sense given a planned revision to `has_arg()` to tighten up
its semantics.
---
ChangeLog | 9 +++++++++
src/roff/troff/env.cpp | 4 ++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 79b718807..957ec07ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-05-21 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp
+ (add_hyphenation_exception_words_request): Refactor. Convert
+ `while` loop to `do-while` loop. (1) We already know at first
+ loop entry that the condition is true and (2) structuring it
+ this way makes more sense given a planned revision to
+ `has_arg()` to tighten up its semantics.
+
2026-05-24 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (set_hyphenation_codes):
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 86eb89ead..a7d23de0c 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -4043,7 +4043,7 @@ static void add_hyphenation_exception_words_request() //
.hw
unsigned char bpbuf[bpbuflen];
(void) memset(bpbuf, 0, bpbuflen);
int bp_count = 0;
- while (has_arg()) {
+ do {
if (read_hyphenation_exception_word(wordbuf, &bp_count, bpbuf)) {
const size_t newbpbuflen = bp_count + 1 /* 0U terminator */;
unsigned char *tem = 0 /* nullptr */;
@@ -4073,7 +4073,7 @@ static void add_hyphenation_exception_words_request() //
.hw
if (tem != 0 /* nullptr */)
delete[] tem;
}
- }
+ } while (has_arg());
skip_line();
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit