groff-commit
[Top][All Lists]
Advanced

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

[groff] 06/08: src/roff/troff/input.cpp: Trivially refactor.


From: G. Branden Robinson
Subject: [groff] 06/08: src/roff/troff/input.cpp: Trivially refactor.
Date: Thu, 12 Sep 2024 11:46:59 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 0de571216e95f78c2d2d0bdafed96cdebdd7f3c9
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Sep 12 00:10:51 2024 -0500

    src/roff/troff/input.cpp: Trivially refactor.
    
    * src/roff/troff/input.cpp (do_open): Rename this...
      (open_file): ...to this.
    
      (open_request, opena_request): Update call sites.
---
 ChangeLog                |  7 +++++++
 src/roff/troff/input.cpp | 10 +++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d620788c2..33f802099 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,13 @@
        might not notice right away.  Fixes problem introduced by me in
        commit 3bb13e4752, 4 September.
 
+2024-09-11  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/input.cpp: Trivially refactor.
+       (do_open): Rename this...
+       (open_file): ...to this.
+       (open_request, opena_request): Update call sites.
+
 2024-09-11  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp: Trivially refactor.  Rename
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 4fd26930b..7890c9600 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -7196,18 +7196,18 @@ void terminal_continue()
 
 dictionary stream_dictionary(20);
 
-static void do_open(bool append)
+static void open_file(bool appending)
 {
   symbol stream = get_name(true /* required */);
   if (!stream.is_null()) {
     symbol filename = get_long_name(true /* required */);
     if (!filename.is_null()) {
       errno = 0;
-      FILE *fp = fopen(filename.contents(), append ? "a" : "w");
+      FILE *fp = fopen(filename.contents(), appending ? "a" : "w");
       if (0 /* nullptr */ == fp) {
        error("cannot open file '%1' for %2: %3",
              filename.contents(),
-             append ? "appending" : "writing",
+             appending ? "appending" : "writing",
              strerror(errno));
        fp = (FILE *)stream_dictionary.remove(stream);
       }
@@ -7228,7 +7228,7 @@ static void open_request() // .open
     skip_line();
   }
   else
-    do_open(false /* don't append */);
+    open_file(false /* appending */);
 }
 
 static void opena_request() // .opena
@@ -7238,7 +7238,7 @@ static void opena_request() // .opena
     skip_line();
   }
   else
-    do_open(true /* append */);
+    open_file(true /* appending */);
 }
 
 static void close_request() // .close



reply via email to

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