gbranden pushed a commit to branch master
in repository groff.
commit a43e0206fdca407d572d107eef85da800a595b6e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Apr 10 09:28:57 2026 -0500
src/roff/troff/env.cpp: Slightly refactor.
* src/roff/troff/env.cpp: Lift `wordbuflen` and `bpbuflen` into
file-global scope...
(add_hyphenation_exception_words_request): ...from here, because we're
going to need them in another function.
---
ChangeLog | 7 +++++++
src/roff/troff/env.cpp | 9 +++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 83fd28572..4861e6f56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -47,6 +47,13 @@
* src/roff/groff/tests/error-overflow-symbol-table.sh: Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
+2026-04-10 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp: Slightly refactor. Lift `wordbuflen`
+ and `bpbuflen` into file-global scope...
+ (add_hyphenation_exception_words_request): ...from here, because
+ we're going to need them in another function.
+
2026-04-10 G. Branden Robinson <[email protected]>
* src/roff/troff/env.cpp
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 15249f9ac..4282286e1 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3911,7 +3911,12 @@ static void environment_switch() // .ev
}
// We use `unsigned char` for offsets in hyphenation exception words.
+// C++11: constexpr
static const int WORD_MAX = UCHAR_MAX;
+// C++11: constexpr
+static const size_t wordbuflen = WORD_MAX + 1 /* '\0' */;
+// C++11: constexpr
+static const size_t bpbuflen = WORD_MAX + 2 /* leading '-' + '\0' */;
static void add_hyphenation_exception_words_request() // .hw
{
@@ -3927,13 +3932,9 @@ static void add_hyphenation_exception_words_request() //
.hw
skip_line();
return;
}
- // C++11: constexpr
- static const size_t wordbuflen = WORD_MAX + 1 /* '\0' */;
// C++11: char wordbuf[wordbuflen]{};
char wordbuf[wordbuflen];
(void) memset(wordbuf, 0, wordbuflen);
- // C++11: constexpr
- static const size_t bpbuflen = WORD_MAX + 2 /* leading '-' + '\0' */;
// C++11: unsigned char bpbuf[bpbuflen]{};
unsigned char bpbuf[bpbuflen];
(void) memset(bpbuf, 0, bpbuflen);
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit