groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 93/115: [troff]: Trivially refactor.


From: G. Branden Robinson
Subject: [groff] 93/115: [troff]: Trivially refactor.
Date: Thu, 1 Jun 2023 10:46:16 -0400 (EDT)

gbranden pushed a commit to branch branden-2022-06-01
in repository groff.

commit 1305eb8c98d97555f1609bbd30510972151da071
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon May 8 21:12:44 2023 -0500

    [troff]: Trivially refactor.
    
    * src/roff/troff/input.cpp (token::~token, token::operator=): Drop
      workaround for bug in compiler (SGI C++) that dates back to groff
      1.07 (March 1993).  But don't go back to using the ternary operator.
---
 ChangeLog                |  9 +++++++++
 src/roff/troff/input.cpp | 14 ++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fe5ec4708..298876e7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-05-08  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [troff]: Trivially refactor.
+
+       * src/roff/troff/input.cpp (token::~token, token::operator=):
+       Drop workaround for bug in compiler (SGI C++) that dates back to
+       groff 1.07 (March 1993).  But don't go back to using the ternary
+       operator.
+
 2023-05-07  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [troff]: Fix Savannah #64104.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 2004458a2..70eb8ecf5 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1798,18 +1798,20 @@ token::~token()
 token::token(const token &t)
 : nm(t.nm), c(t.c), val(t.val), dim(t.dim), type(t.type)
 {
-  // Use two statements to work around bug in SGI C++.
-  node *tem = t.nd;
-  nd = tem ? tem->copy() : 0;
+  if (t.nd != 0 /* nullptr */)
+    nd = t.nd->copy();
+  else
+    nd = 0 /* nullptr */;
 }
 
 void token::operator=(const token &t)
 {
   delete nd;
   nm = t.nm;
-  // Use two statements to work around bug in SGI C++.
-  node *tem = t.nd;
-  nd = tem ? tem->copy() : 0;
+  if (t.nd != 0 /* nullptr */)
+    nd = t.nd->copy();
+  else
+    nd = 0 /* nullptr */;
   c = t.c;
   val = t.val;
   dim = t.dim;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]