[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 40/48: [troff]: Slightly refactor (6/6).
From: |
G. Branden Robinson |
Subject: |
[groff] 40/48: [troff]: Slightly refactor (6/6). |
Date: |
Thu, 15 Aug 2024 13:15:37 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit faf192412b273082f45e5d9d579b453838d98436
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Aug 14 14:44:23 2024 -0500
[troff]: Slightly refactor (6/6).
* src/roff/troff/node.h (struct node): Demote `is_inner` argument from
`int` to `bool` and assign to it using Boolean, not integer, literals.
---
ChangeLog | 4 ++++
src/roff/troff/node.cpp | 20 +++++++++++---------
src/roff/troff/node.h | 6 +++---
3 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a0c8671d4..63dbf84de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,10 @@
member from `unsigned char` to `bool`. Use Boolean literals for
it in constructors' initializer lists.
+ * src/roff/troff/node.h (struct node): Demote `is_inner`
+ argument from `int` to `bool` and assign to it using Boolean,
+ not integer, literals.
+
2024-08-14 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/token.h (token:ch()): Return character instead
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index b86ca41f6..c49983b43 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -1984,7 +1984,7 @@ public:
hunits subscript_correction();
void tprint(troff_output_file *);
breakpoint *get_breakpoints(hunits width, int ns, breakpoint *rest = 0,
- int is_inner = 0);
+ bool is_inner = false);
int nbreaks();
int ends_sentence();
void split(int, node **, node **);
@@ -3675,8 +3675,8 @@ void vertical_size_node::asciify(macro *)
delete this;
}
-breakpoint *node::get_breakpoints(hunits /*width*/, int /*nspaces*/,
- breakpoint *rest, int /*is_inner*/)
+breakpoint *node::get_breakpoints(hunits /* width */, int /* nspaces */,
+ breakpoint *rest, bool /* is_inner */)
{
return rest;
}
@@ -3687,7 +3687,7 @@ int node::nbreaks()
}
breakpoint *space_node::get_breakpoints(hunits wd, int ns,
- breakpoint *rest, int is_inner)
+ breakpoint *rest, bool is_inner)
{
if (next && next->discardable())
return rest;
@@ -3722,16 +3722,17 @@ static breakpoint *node_list_get_breakpoints(node *p,
hunits *widthp,
if (p != 0 /* nullptr */) {
rest = p->get_breakpoints(*widthp,
ns,
- node_list_get_breakpoints(p->next, widthp, ns,
- rest),
- 1);
+ node_list_get_breakpoints(p->next, widthp,
+ ns, rest),
+ true);
*widthp += p->width();
}
return rest;
}
breakpoint *dbreak_node::get_breakpoints(hunits wd, int ns,
- breakpoint *rest, int is_inner)
+ breakpoint *rest,
+ bool is_inner)
{
breakpoint *bp = new breakpoint;
bp->next = rest;
@@ -4508,7 +4509,8 @@ bool unbreakable_space_node::is_tag()
}
breakpoint *unbreakable_space_node::get_breakpoints(hunits, int,
- breakpoint *rest, int)
+ breakpoint *rest,
+ bool /* is_inner */)
{
return rest;
}
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index a7a89d1f8..2db44f56e 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -93,7 +93,7 @@ struct node {
virtual void is_escape_colon();
virtual breakpoint *get_breakpoints(hunits, int,
breakpoint * /* rest */ = 0 /* nullptr */,
- int /* is_inner */ = 0);
+ bool /* is_inner */ = false);
virtual int nbreaks();
virtual void split(int, node **, node **);
virtual hyphenation_type get_hyphenation_type();
@@ -198,7 +198,7 @@ public:
void tprint(troff_output_file *);
breakpoint *get_breakpoints(hunits, int,
breakpoint * /* rest */ = 0 /* nullptr */,
- int /* is_inner */ = 0);
+ bool /* is_inner */ = false);
int nbreaks();
void split(int, node **, node **);
void ascii_print(ascii_output_file *);
@@ -256,7 +256,7 @@ public:
bool is_tag();
breakpoint *get_breakpoints(hunits, int,
breakpoint * /* rest */ = 0 /* nullptr */,
- int /* is_inner */ = 0);
+ bool /* is_inner */ = false);
int nbreaks();
void split(int, node **, node **);
int merge_space(hunits, hunits, hunits);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 40/48: [troff]: Slightly refactor (6/6).,
G. Branden Robinson <=