gbranden pushed a commit to branch master
in repository groff.
commit 1e4ef794bf61b9b35f96aa738edb7f4939c4cd3d
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Jul 10 16:59:55 2025 -0500
[libgroff]: Trivially refactor.
* src/libs/libgroff/font.cpp (text_file::next_line): Reorder equality
comparisons to avoid inadvertent lvalue assignment.
---
ChangeLog | 6 ++++++
src/libs/libgroff/font.cpp | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f04f1660c..8ec27469f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-07-10 G. Branden Robinson <[email protected]>
+
+ * src/libs/libgroff/font.cpp (text_file::next_line): Trivially
+ refactor. Reorder equality comparisons to avoid inadvertent
+ lvalue assignment.
+
2025-07-10 G. Branden Robinson <[email protected]>
Retire our `strerror()` implementation. It was specified in
diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp
index c0d428963..ce1907756 100644
--- a/src/libs/libgroff/font.cpp
+++ b/src/libs/libgroff/font.cpp
@@ -121,7 +121,7 @@ bool text_file::next_line()
int length = 0;
for (;;) {
int c = getc(fp);
- if (c == EOF)
+ if (EOF == c)
break;
if (is_invalid_input_char(c))
error("invalid input character code %1", int(c));
@@ -134,7 +134,7 @@ bool text_file::next_line()
linebufsize *= 2;
}
buf[length++] = c;
- if (c == '\n')
+ if ('\n' == c)
break;
}
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit