gbranden pushed a commit to branch master
in repository groff.
commit 3fe2c11b285be96f75e12bf2c96531015481c92d
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 16 19:51:07 2025 -0600
[troff]: Slightly refactor.
* src/roff/troff/input.cpp (assign_escape_character)
(interpolate_arg): Mark variables pointing to character array literals
as `static` and `const`.
(assign_escape_character): Mark variable that selects between one of
the aforementioned static literals a pointer to `const`.
---
ChangeLog | 8 ++++++++
src/roff/troff/input.cpp | 11 ++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 63f4e893e..41502c581 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-11-16 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp: Slightly refactor.
+ (assign_escape_character, interpolate_arg): Mark variables
+ pointing to character array literals as `static` and `const`.
+ (assign_escape_character): Mark variable that selects between
+ one of the aforementioned static literals a pointer to `const`.
+
2025-11-16 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (get_line_arg): Trivially refactor.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 114496beb..bd013a19a 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -203,9 +203,10 @@ static void assign_escape_character()
else
ec = '\\';
bool do_nothing = false;
- char already_cc[] = "the control character is already";
- char already_nbcc[] = "the no-break control character is already";
- char *already_message = 0 /* nullptr */;
+ static const char already_cc[] = "the control character is already";
+ static const char already_nbcc[] = "the no-break control character is"
+ " already";
+ const char *already_message = 0 /* nullptr */;
if (curenv->get_control_character() == ec) {
already_message = already_cc;
do_nothing = true;
@@ -5172,8 +5173,8 @@ static void interpolate_arg(symbol nm)
is_printable = false;
}
if (!is_valid) {
- const char msg[] = "invalid positional argument number in copy"
- " mode";
+ static const char msg[] = "invalid positional argument number in"
+ " copy mode";
if (is_printable)
copy_mode_error("%1 '%2'", msg, s);
else
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit