gbranden pushed a commit to branch master
in repository groff.
commit 00e92e1c29bde34dc4ba7a7c48820d75e8d13fac
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Apr 10 00:03:59 2026 -0500
src/libs/libgroff/symbol.cpp: Fix code style nits.
* src/libs/libgroff/symbol.cpp (symbol::symbol): Use explicit
`const_cast` C++ operator instead of C-style cast. Parenthesize
formally complex expressions.
---
ChangeLog | 6 ++++++
src/libs/libgroff/symbol.cpp | 6 +++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 56452861d..85f32004c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-04-10 G. Branden Robinson <[email protected]>
+
+ * src/libs/libgroff/symbol.cpp (symbol::symbol): Fix code style
+ nits. Use explicit `const_cast` C++ operator instead of C-style
+ cast. Parenthesize formally complex expressions.
+
2026-04-10 G. Branden Robinson <[email protected]>
* src/libs/libgroff/symbol.cpp (symbol::symbol): Improve fatal
diff --git a/src/libs/libgroff/symbol.cpp b/src/libs/libgroff/symbol.cpp
index be03e1bbe..b9915e639 100644
--- a/src/libs/libgroff/symbol.cpp
+++ b/src/libs/libgroff/symbol.cpp
@@ -98,7 +98,7 @@ symbol::symbol(const char *p, int how)
}
if (table == 0 /* nullptr */) {
table_size = table_sizes[0];
- table = (const char **)new char*[table_size];
+ table = const_cast<const char **>(new char *[table_size]);
for (int i = 0; i < table_size; i++)
table[i] = 0 /* nullptr */;
table_occupancy = 0;
@@ -107,7 +107,7 @@ symbol::symbol(const char *p, int how)
const char **pp;
for (pp = table + hc % table_size;
*pp != 0 /* nullptr */;
- (pp == table ? pp = table + table_size - 1 : --pp))
+ (pp == table ? (pp = (table + table_size - 1)) : --pp))
if (strcmp(p, *pp) == 0) {
s = *pp;
return;
@@ -127,7 +127,7 @@ symbol::symbol(const char *p, int how)
table_sizes[(i - 1)]);
table_size = table_sizes[i];
table_occupancy = 0;
- table = (const char **)new char*[table_size];
+ table = const_cast<const char **>(new char *[table_size]);
for (i = 0; i < table_size; i++)
table[i] = 0 /* nullptr */;
for (pp = old_table + old_table_size - 1;
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit