gbranden pushed a commit to branch master
in repository groff.
commit 8693f3ef5432fb2908401234efc8872f9491bac5
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Apr 9 23:06:05 2026 -0500
src/roff/troff/env.cpp: Slightly refactor.
* src/roff/troff/env.cpp: Use `UCHAR_MAX` from ISO C99's standard
library instead of the literal `256` to configure the `WORD_MAX`
constant. Preprocessor-include "<limits.h>" header file to access
`UCHAR_MAX`. Declare `WORD_MAX` as `static`; external linkage is not
required.
---
ChangeLog | 8 ++++++++
src/roff/troff/env.cpp | 5 +++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ae46e7388..29648718e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2026-04-09 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp: Use `UCHAR_MAX` from ISO C99's
+ standard library instead of the literal `256` to configure the
+ `WORD_MAX` constant. Preprocessor-include "<limits.h>" header
+ file to access `UCHAR_MAX`. Declare `WORD_MAX` as `static`;
+ external linkage is not required.
+
2026-04-09 G. Branden Robinson <[email protected]>
* src/roff/troff/number.cpp (read_measurement_crement)
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index e6f89dbbf..d68531c32 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -24,6 +24,7 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
#include <assert.h>
#include <errno.h>
+#include <limits.h> // UCHAR_MAX
#include <math.h> // ceil(), fabs()
#include <stdio.h> // prerequisite of mtsm.h, searchpath.h
@@ -3906,8 +3907,8 @@ static void environment_switch() // .ev
skip_line();
}
-const int WORD_MAX = 256; // we use unsigned char for offsets in
- // hyphenation exceptions
+// We use `unsigned char` for offsets in hyphenation exception words.
+static const int WORD_MAX = UCHAR_MAX;
static void add_hyphenation_exception_words_request() // .hw
{
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit