groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/10: src/roff/troff/env.cpp: Further slightly refactor.


From: G. Branden Robinson
Subject: [groff] 03/10: src/roff/troff/env.cpp: Further slightly refactor.
Date: Mon, 6 Sep 2021 15:01:23 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit fe65953601e8e75f4a012ea791fbefa22217af4b
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Sep 5 04:52:47 2021 +1000

    src/roff/troff/env.cpp: Further slightly refactor.
    
    * src/roff/troff/env.cpp (do_underline_special):
      - Relocate function to avoid forward reference.
      - Mark function as static to eliminate external linkage.  Remove
        now-unnecessary prototype.
---
 ChangeLog              |  5 ++++-
 src/roff/troff/env.cpp | 16 +++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f5a4d6b..025d6dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,11 +3,14 @@
        * src/roff/troff/env.cpp (do_underline_special): Refactor
        slightly.
          - Rename `underline_spaces` -> `do_underline_spaces`.
-         - Demote it from an `int` to a `bool`.  Update prototype.
+         - Demote it from an `int` to a `bool`.
          - Use ternary operator and explicit character literals when
            writing device control command instead of doing arithmetic
            on a character literal.
          - Update call sites to use Boolean literals.
+         - Relocate function to avoid forward reference.
+         - Mark function as static to eliminate external linkage.
+           Remove now-unnecessary prototype.
 
 2021-09-04  Keith Marshall  <keith.d.marshall@ntlworld.com>
 
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index ae75323..da4ed6e 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -488,7 +488,13 @@ void environment::space(hunits space_width, hunits 
sentence_space_width)
   spread_flag = 0;
 }
 
-node *do_underline_special(bool);
+static node *do_underline_special(bool do_underline_spaces)
+{
+  macro m;
+  m.append_str("x u ");
+  m.append(do_underline_spaces ? '1' : '0');
+  return new special_node(m, 1);
+}
 
 void environment::set_font(symbol nm)
 {
@@ -1460,14 +1466,6 @@ void temporary_indent()
   tok.next();
 }
 
-node *do_underline_special(bool do_underline_spaces)
-{
-  macro m;
-  m.append_str("x u ");
-  m.append(do_underline_spaces ? '1' : '0');
-  return new special_node(m, 1);
-}
-
 void do_underline(int underline_spaces)
 {
   int n;



reply via email to

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