groff-commit
[Top][All Lists]
Advanced

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

[groff] 04/26: [refer]: Trivially refactor: boolify.


From: G. Branden Robinson
Subject: [groff] 04/26: [refer]: Trivially refactor: boolify.
Date: Sun, 15 May 2022 05:07:52 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit cc5c67a04e07e8bc8d72bc0fd18719e588eb28d0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed May 4 18:56:50 2022 -0500

    [refer]: Trivially refactor: boolify.
    
    * src/preproc/refer/command.cpp (input_stack::push_file): Demote and
      rename local variable from `int` to `bool`.
    
      (bol): Renamed from this...
    
      (is_at_beginning_of_line): ...to this.
---
 ChangeLog                     | 9 +++++++++
 src/preproc/refer/command.cpp | 8 ++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c6dd271b..309ff1fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-05-04  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [refer]: Trivially refactor: boolify.
+
+       * src/preproc/refer/command.cpp (input_stack::push_file): Demote
+       and rename local variable from `int` to `bool`.
+       (bol): Renamed from this...
+       (is_at_beginning_of_line): ...to this.
+
 2022-05-04  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [refer]: Trivially refactor.
diff --git a/src/preproc/refer/command.cpp b/src/preproc/refer/command.cpp
index 33cc2b10..3f8c4741 100644
--- a/src/preproc/refer/command.cpp
+++ b/src/preproc/refer/command.cpp
@@ -160,11 +160,11 @@ void input_stack::push_file(const char *fn)
     }
   }
   string buf;
-  int bol = 1;
+  bool is_at_beginning_of_line = true;
   int lineno = 1;
   for (;;) {
     int c = getc(fp);
-    if (bol && c == '.') {
+    if (is_at_beginning_of_line && c == '.') {
       // replace lines beginning with .R1 or .R2 with a blank line
       c = getc(fp);
       if (c == 'R') {
@@ -198,11 +198,11 @@ void input_stack::push_file(const char *fn)
     else {
       buf += c;
       if (c == '\n') {
-       bol = 1;
+       is_at_beginning_of_line = true;
        lineno++;
       }
       else
-       bol = 0;
+       is_at_beginning_of_line = false;
     }
   }
   if (fp != stdin)



reply via email to

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