gbranden pushed a commit to branch master
in repository groff.
commit a577bde522c108c31812cce6d250a63eed2b7618
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Nov 16 12:09:06 2026 -0600
src/preproc/pic/lex.ypp: Fix code style nits.
* src/preproc/pic/lex.ypp (get_token)
(copy_file_thru_input::inget)
(get_thru_arg): Explicitly compare variable of pointer type to ISO
C++98 null pointer literal, instead of punning it down to a Boolean.
Arrange equality comparisons to avoid inadvertent assignment to
lvalue.
---
ChangeLog | 9 +++++++++
src/preproc/pic/lex.cpp | 6 +++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2e725a306..bcb91dd7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-11-16 G. Branden Robinson <[email protected]>
+
+ * src/preproc/pic/lex.ypp (get_token)
+ (copy_file_thru_input::inget)
+ (get_thru_arg): Explicitly compare variable of pointer type to
+ ISO C++98 null pointer literal, instead of punning it down to a
+ Boolean. Arrange equality comparisons to avoid inadvertent
+ assignment to lvalue.
+
2026-11-16 G. Branden Robinson <[email protected]>
* src/preproc/pic/pic.ypp: Trivially refactor. Rename
diff --git a/src/preproc/pic/lex.cpp b/src/preproc/pic/lex.cpp
index de37aa867..5299d6740 100644
--- a/src/preproc/pic/lex.cpp
+++ b/src/preproc/pic/lex.cpp
@@ -1331,7 +1331,7 @@ static int get_token(bool want_macro_expansion = true)
input_stack::push(new macro_input(def));
}
}
- if (!def) {
+ if (0 /* nullptr */ == def) {
context_buffer = token_buffer;
if (csupper(token_buffer[0]))
return LABEL;
@@ -1596,7 +1596,7 @@ copy_file_thru_input::~copy_file_thru_input()
int copy_file_thru_input::inget()
{
- if (!in)
+ if (0 /* nullptr */ == in)
return EOF;
else
return in->get();
@@ -1842,7 +1842,7 @@ static char *get_thru_arg()
context_buffer = token_buffer;
token_buffer += '\0';
char *def = macro_table.lookup(token_buffer.contents());
- if (def)
+ if (def != 0 /* nullptr */)
return strsave(def);
// I guess it wasn't a macro after all; so push the macro name back.
for (size_t i = (token_buffer.length() - 1); i > 0; i--)
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit