[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 07/60: [troff]: Trivially refactor.
From: |
G. Branden Robinson |
Subject: |
[groff] 07/60: [troff]: Trivially refactor. |
Date: |
Wed, 11 Sep 2024 03:38:27 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit bed0878ee174ccf1b1d672313b6de7e6d4b10c2f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Sep 8 04:29:04 2024 -0500
[troff]: Trivially refactor.
* src/roff/troff/div.cpp (flush_output): Rename this...
(flush_request): ...to this. Also declare it `static` since it
has no callers external to the translation unit.
(init_div_requests): Update request initialization.
Also annotate null pointer with `nullptr` comment to ease any future
transition to C++11, which defines it as a keyword.
---
ChangeLog | 7 +++++++
src/roff/troff/div.cpp | 10 +++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4e770060d..a3f8be846 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/div.cpp (flush_output): Rename this...
+ (flush_request): ...to this. Also declare it `static` since it
+ has no callers external to the translation unit.
+ (init_div_requests): Update request initialization.
+
2024-09-08 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/node.cpp (class troff_output_file): Trivially
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index a328da8fc..1f1a7724f 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -616,7 +616,7 @@ void end_diversions()
void cleanup_and_exit(int exit_code)
{
- if (the_output) {
+ if (the_output != 0 /* nullptr */) {
the_output->trailer(topdiv->get_page_length());
// If we're already dying, don't call the_output's destructor. See
// node.cpp:real_output_file::~real_output_file().
@@ -642,7 +642,7 @@ bool top_level_diversion::begin_page(vunits n)
}
if (last_page_number > 0 && page_number == last_page_number)
cleanup_and_exit(EXIT_SUCCESS);
- if (!the_output)
+ if (0 /* nullptr */ == the_output)
init_output();
++page_count;
if (have_next_page_number) {
@@ -913,13 +913,13 @@ void output_saved_vertical_space()
tok.next();
}
-void flush_output()
+static void flush_request()
{
while (!tok.is_newline() && !tok.is_eof())
tok.next();
if (want_break)
curenv->do_break();
- if (the_output)
+ if (the_output != 0 /* nullptr */)
the_output->flush();
tok.next();
}
@@ -1243,7 +1243,7 @@ void init_div_requests()
init_request("da", divert_append);
init_request("di", divert);
init_request("dt", diversion_trap);
- init_request("fl", flush_output);
+ init_request("fl", flush_request);
init_request("mk", mark);
init_request("ne", need_space);
init_request("ns", no_space);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 07/60: [troff]: Trivially refactor.,
G. Branden Robinson <=