gbranden pushed a commit to branch master
in repository groff.
commit 6169595649a28e77b1062b40e261c6bead9a380e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Jun 4 08:51:03 2025 -0500
src/roff/troff/node.cpp: Fix code style nits.
* src/roff/troff/node.cpp: Fix code style nits.
(get_font_translation, mount_font_no_translate, lookup_family): Favor
C++ `static_cast<>` operator over omnipotent C-style casts.
(mount_font_no_translate): Drop braces around single-statement control
flow branch; groff generally eschews these.
---
ChangeLog | 9 +++++++++
src/roff/troff/node.cpp | 10 +++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e9739793d..2475f83d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-06-04 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/node.cpp: Fix code style nits.
+ (get_font_translation, mount_font_no_translate, lookup_family):
+ Favor C++ `static_cast<>` operator over omnipotent C-style
+ casts.
+ (mount_font_no_translate): Drop braces around single-statement
+ control flow branch; groff generally eschews these.
+
2025-06-04 G. Branden Robinson <[email protected]>
[libgroff, troff]: Refactor.
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index f2477b671..de7cb2a48 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6491,7 +6491,7 @@ dictionary font_translation_dictionary(17);
static symbol get_font_translation(symbol nm)
{
void *p = font_translation_dictionary.lookup(nm);
- return p ? symbol((char *)p) : nm;
+ return p ? symbol(static_cast<char *>(p)) : nm;
}
dictionary font_dictionary(50);
@@ -6519,11 +6519,10 @@ static bool mount_font_no_translate(int n, symbol name,
}
(void) font_dictionary.lookup(name, fm);
}
- else if (&nonexistent_font == p) {
+ else if (&nonexistent_font == p)
return false;
- }
else
- fm = (font*)p;
+ fm = static_cast<font *>(p);
if (check_only)
return true;
if (n >= font_table_size) {
@@ -6724,7 +6723,8 @@ dictionary family_dictionary(5);
font_family *lookup_family(symbol nm)
{
- font_family *f = (font_family *)family_dictionary.lookup(nm);
+ font_family *f
+ = static_cast<font_family *>(family_dictionary.lookup(nm));
if (!f) {
f = new font_family(nm);
(void) family_dictionary.lookup(nm, f);
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit