gbranden pushed a commit to branch master
in repository groff.

commit d6a65c0c5ee68a283e3414cdebc2409176ac082b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Aug 14 13:19:26 2024 -0500

    [troff]: Slightly refactor (2/6).
    
    * src/roff/troff/node.h (struct hyphen_list): Boolify. Demote
      `breakable` member from `unsigned char` to `bool` and rename it to
      `is_breakable'.
    
      (hyphen_list::hyphen_list): Migrate struct initializer list to new
      name and Boolean literal.
    
    * src/roff/troff/env.cpp (environment::hyphenate_line):
    * src/roff/troff/node.cpp (break_char_node::add_self): Update
      comparisons.
---
 ChangeLog               | 9 +++++++++
 src/roff/troff/env.cpp  | 6 +++---
 src/roff/troff/node.cpp | 4 ++--
 src/roff/troff/node.h   | 4 ++--
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 10fcec9b4..05f8f05b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,15 @@
        * src/roff/troff/node.cpp (glyph_node::add_self)
        (composite_node::add_self): Update comparisons to use new name.
 
+       * src/roff/troff/node.h (struct hyphen_list): Boolify. Demote
+       `breakable` member from `unsigned char` to `bool` and rename it
+       to `is_breakable'.
+       (hyphen_list::hyphen_list): Migrate struct initializer list to
+       new name and Boolean literal.
+       * src/roff/troff/env.cpp (environment::hyphenate_line):
+       * src/roff/troff/node.cpp (break_char_node::add_self): Update
+       comparisons.
+
 2024-08-14  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/token.h (token:ch()): Return character instead
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index c67668502..aba08eb16 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2108,9 +2108,9 @@ void environment::hyphenate_line(bool must_break_here)
     // this is for characters like hyphen and emdash
     int prev_code = 0;
     for (hyphen_list *h = sl; h; h = h->next) {
-      h->breakable = (prev_code != 0
-                     && h->next != 0 /* nullptr */
-                     && h->next->hyphenation_code != 0);
+      h->is_breakable = (prev_code != 0
+                        && h->next != 0 /* nullptr */
+                        && h->next->hyphenation_code != 0);
       prev_code = h->hyphenation_code;
     }
   }
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 93828cf92..781c9087d 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -2870,7 +2870,7 @@ node *break_char_node::add_self(node *n, hyphen_list **p)
   int have_space_node = 0;
   assert((*p)->hyphenation_code == 0);
   if (break_code & CAN_BREAK_BEFORE) {
-    if ((*p)->breakable || break_code & IGNORE_HCODES) {
+    if ((*p)->is_breakable || break_code & IGNORE_HCODES) {
       n = new space_node(H0, col, n);
       n->freeze_space();
       have_space_node = 1;
@@ -2892,7 +2892,7 @@ node *break_char_node::add_self(node *n, hyphen_list **p)
   next = n;
   n = this;
   if (break_code & CAN_BREAK_AFTER) {
-    if ((*p)->breakable || break_code & IGNORE_HCODES) {
+    if ((*p)->is_breakable || break_code & IGNORE_HCODES) {
       n = new space_node(H0, col, n);
       n->freeze_space();
     }
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index c98ad0abd..b13261a99 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -18,7 +18,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 
 struct hyphen_list {
   bool is_hyphen;
-  unsigned char breakable;
+  bool is_breakable;
   unsigned char hyphenation_code;
   hyphen_list *next;
   hyphen_list(unsigned char code,
@@ -638,7 +638,7 @@ node *copy_node_list(node *);
 int get_bold_fontno(int);
 
 inline hyphen_list::hyphen_list(unsigned char code, hyphen_list *p)
-: is_hyphen(false), breakable(0), hyphenation_code(code), next(p)
+: is_hyphen(false), is_breakable(false), hyphenation_code(code), next(p)
 {
 }
 

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to