gbranden pushed a commit to branch master
in repository groff.

commit bcbe9e8a1d4e5838bc051edf9ef26a9b8355c3a5
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Sun Mar 2 10:36:52 2025 -0600

    [troff]: Fix code style nit.
    
    * src/roff/troff/node.cpp (hline_node::~hline_node)
      (vline_node::~vline_node): Fix code style nit, simplifying.
    
    It is not necessary to make conditional the `delete[]` of a null
    pointer.  "If the _delete-expression_ calls the implementation
    deallocation function (3.7.3.2), and if the operand of the delete
    expression is not the null pointer constant, the deallocation function
    will deallocate the storage referenced by the pointer thus rendering the
    pointer invalid" (ISO/IEC 14882-1998, ยง5.3.5, paragraph 4).  Or as
    Stroustrup puts it, "Applying _delete_ to zero has no effect." (_The C++
    Programming Language, Special Edition_, p. 128).
---
 ChangeLog               | 5 +++++
 src/roff/troff/node.cpp | 6 ++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dafc3875f..84f6ca9cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-03-02  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       * src/roff/troff/node.cpp (hline_node::~hline_node)
+       (vline_node::~vline_node): Fix code style nit, simplifying.
+
 2025-03-02  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/input.cpp (copy_file, transparent_file): Drop
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 4ba404a39..507b21bf2 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -3040,8 +3040,7 @@ node *transparent_dummy_node::copy()
 
 hline_node::~hline_node()
 {
-  if (n)
-    delete n;
+  delete n;
 }
 
 hline_node::hline_node(hunits i, node *c, node *nxt)
@@ -3078,8 +3077,7 @@ vline_node::vline_node(vunits i, node *c, statem *s,
 
 vline_node::~vline_node()
 {
-  if (n)
-    delete n;
+  delete n;
 }
 
 node *vline_node::copy()

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to