gbranden pushed a commit to branch master
in repository groff.
commit a76c70e5f922ecb3081498c42495fbd6a049f7b8
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Oct 26 19:27:25 2025 -0500
[grotty]: Fix code style nits.
* src/devices/grotty/tty.cpp (tty_printer::special_link): Parenthesize
formally complex expressions. Reorder equality comparisons to avoid
inadvertent lvalue assignment.
---
ChangeLog | 7 +++++++
src/devices/grotty/tty.cpp | 8 ++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 43880b700..b32662c5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-10-26 G. Branden Robinson <[email protected]>
+
+ * src/devices/grotty/tty.cpp (tty_printer::special_link): Fix
+ code style nits. Parenthesize formally complex expressions.
+ Reorder equality comparisons to avoid inadvertent lvalue
+ assignment.
+
2025-10-23 G. Branden Robinson <[email protected]>
* doc/doc.am: Build PDF documents more carefully.
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index d43371dcf..2b40cfe6a 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -493,7 +493,7 @@ void tty_printer::special_link(const char *arg, const
environment *env)
}
else {
// Our caller ensures that we see whitespace after 'link'.
- assert(c == ' ' || c == '\t');
+ assert((' ' == c) || ('\t' == c));
if (is_link_active) {
warning("new hyperlink started without ending previous one;"
" recovering");
@@ -505,13 +505,13 @@ void tty_printer::special_link(const char *arg, const
environment *env)
is_link_active = true;
do
c = *arg++;
- while (c == ' ' || c == '\t');
+ while ((' ' == c) || ('\t' == c));
arg--;
// The first argument is the URI.
const char *uri = arg;
do
c = *arg++;
- while (c != '\0' && c != ' ' && c != '\t');
+ while ((c != '\0') && (c != ' ') && (c != '\t'));
arg--;
ptrdiff_t uri_len = arg - uri;
// Any remaining arguments are "key=value" pairs.
@@ -526,7 +526,7 @@ void tty_printer::special_link(const char *arg, const
environment *env)
c = *arg++;
if ('\0' == c)
done = true;
- else if (' ' == c || '\t' == c)
+ else if ((' ' == c) || ('\t' == c))
in_pair = false;
else
simple_add_char(c, env);
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit