gbranden pushed a commit to branch master
in repository groff.
commit da4ab3e537f9c88d0b5aac45d81e19703fea4d43
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Aug 11 20:35:21 2023 -0500
[eqn]: Trivially refactor.
* src/preproc/eqn/main.cpp (input_char_description): Migrate to
`const`-qualified object to size an array of length computed at
compile time and avoid repeating lengthy expression.
---
ChangeLog | 8 ++++++++
src/preproc/eqn/main.cpp | 5 ++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index aff853bea..da4bd9f2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-08-11 G. Branden Robinson <[email protected]>
+
+ [eqn]: Trivially refactor.
+
+ * src/preproc/eqn/main.cpp (input_char_description): Migrate to
+ `const`-qualified object to size an array of length computed at
+ compile time and avoid repeating lengthy expression.
+
2023-08-10 G. Branden Robinson <[email protected]>
[man]: Add new `TS` register to configure required separation
diff --git a/src/preproc/eqn/main.cpp b/src/preproc/eqn/main.cpp
index 324e2b4fb..19c8b29a5 100644
--- a/src/preproc/eqn/main.cpp
+++ b/src/preproc/eqn/main.cpp
@@ -62,9 +62,8 @@ static const char *input_char_description(int c)
case '\177':
return "a delete character";
}
- size_t bufsz = sizeof "character code " + INT_DIGITS + 1;
- // repeat expression; no VLAs in ISO C++
- static char buf[sizeof "character code " + INT_DIGITS + 1];
+ const size_t bufsz = sizeof "character code " + INT_DIGITS + 1;
+ static char buf[bufsz];
(void) memset(buf, 0, bufsz);
if (csprint(c)) {
buf[0] = '\'';
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit