gbranden pushed a commit to branch master
in repository groff.
commit 0dee53339a15db6efaa1fad773826e53e46eb19e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Jan 14 10:58:02 2025 -0600
src/roff/troff/env.cpp: Trivially refactor.
...to reduce derp.
* src/roff/troff/env.cpp (do_input_trap): Directly copy Boolean value
instead of using a control structure.
This code wasn't _born_ as an exhibit from the Daily WTF; it evolved
into that shape by stages. Historically, groff never used the C++
`bool` type, and when Werner Lemberg introduced the `itc` request in
about 2002, he stuck to James Clark's AARM-era C++ conventions.[*]
A conditional that distinguished a zero value from any nonzero value and
made a Boolean-valued assignment made sense at the time. But no longer.
[*] C++ itself has only gradually thrown off the C programmer's typeless
mentality that everything that can be represented as an integer should
be handled as an integer in source code. Now, has C++ infected C99 with
`bool` and C23 with `nullptr`, to the fury of PDP-11 veterans worldwide.
Real Programmers don't say what they mean, they say the bit pattern that
they think the machine will use.
---
ChangeLog | 5 +++++
src/roff/troff/env.cpp | 7 ++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0d053e3b4..a4e8bb9cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-01-14 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp (do_input_trap): Directly copy Boolean
+ value instead of using a control structure.
+
2025-01-07 Ingo Schwarze <[email protected]>
* tmac/mdoc/doc-syms: Support .St -isoC-2023.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index e23d67b1b..e57f3aefa 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2025 Free Software Foundation, Inc.
Written by James Clark ([email protected])
This file is part of groff.
@@ -2699,10 +2699,7 @@ void do_input_trap(bool respect_continuation)
{
curenv->input_trap_count = -1;
curenv->input_trap = 0 /* nullptr */;
- if (respect_continuation)
- curenv->continued_input_trap = true;
- else
- curenv->continued_input_trap = false;
+ curenv->continued_input_trap = respect_continuation;
int n;
if (has_arg() && get_integer(&n)) {
if (n <= 0)
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit