groff-commit
[Top][All Lists]
Advanced

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

[groff] 18/18: src/roff/troff/input.cpp (get_copy): Boolify.


From: G. Branden Robinson
Subject: [groff] 18/18: src/roff/troff/input.cpp (get_copy): Boolify.
Date: Fri, 20 Aug 2021 06:25:25 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 9db4ca567d96b93b99f31dae9ae297dc258d82ab
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Aug 20 19:14:04 2021 +1000

    src/roff/troff/input.cpp (get_copy): Boolify.
    
    * src/roff/troff/input.cpp (get_copy): Demote integer arguments to
      Booleans and use Boolean literals for default values.  Rename
      `defining` to `is_defining`.
    
      (get_char_for_escape_name, do_define_macro): Update call sites that
      use non-default arguments to use Boolean literals and comments to
      document what's being requested.
---
 ChangeLog                |  9 +++++++++
 src/roff/troff/input.cpp | 16 ++++++++--------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c967884..f85e06a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2021-08-20  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/input.cpp (get_copy): Demote integer arguments
+       to Booleans and use Boolean literals for default values.  Rename
+       `defining` to `is_defining`.
+       (get_char_for_escape_name, do_define_macro): Update call sites
+       that use non-default arguments to use Boolean literals and
+       comments to document what's being requested.
+
 2021-08-17  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * doc/doc.am (DOC_GROFF_ONLY): Stop running groff in unsafe
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 988fb1e..24b661c 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -128,7 +128,7 @@ search_path *mac_path = &safer_macro_path;
 // Defaults to the current directory.
 search_path include_search_path(0, 0, 0, 1);
 
-static int get_copy(node**, int = 0, int = 0);
+static int get_copy(node**, bool = false, bool = false);
 static void copy_mode_error(const char *,
                            const errarg & = empty_errarg,
                            const errarg & = empty_errarg,
@@ -821,7 +821,7 @@ void shift()
 
 static char get_char_for_escape_name(int allow_space = 0)
 {
-  int c = get_copy(0, 0, 1);
+  int c = get_copy(0, false /* is defining */, true /* handle \E */);
   switch (c) {
   case EOF:
     copy_mode_error("end of input in escape name");
@@ -962,7 +962,7 @@ static symbol read_increment_and_escape_name(int *incp)
   return symbol(buf);
 }
 
-static int get_copy(node **nd, int defining, int handle_escape_E)
+static int get_copy(node **nd, bool is_defining, bool handle_escape_E)
 {
   for (;;) {
     int c = input_stack::get(nd);
@@ -993,7 +993,7 @@ static int get_copy(node **nd, int defining, int 
handle_escape_E)
     if (c == ESCAPE_E && handle_escape_E)
       c = escape_char;
     if (c == ESCAPE_NEWLINE) {
-      if (defining)
+      if (is_defining)
        return c;
       do {
        c = input_stack::get(nd);
@@ -1080,7 +1080,7 @@ static int get_copy(node **nd, int defining, int 
handle_escape_E)
       }
     case '\n':
       (void)input_stack::get(0);
-      if (defining)
+      if (is_defining)
        return ESCAPE_NEWLINE;
       break;
     case ' ':
@@ -4495,7 +4495,7 @@ void do_define_macro(define_mode mode, calling_mode 
calling, comp_mode comp)
                                                      &start_lineno);
   node *n;
   // doing this here makes the line numbers come out right
-  int c = get_copy(&n, 1);
+  int c = get_copy(&n, true /* is defining*/);
   macro mac;
   macro *mm = 0;
   if (mode == DEFINE_NORMAL || mode == DEFINE_APPEND) {
@@ -4517,7 +4517,7 @@ void do_define_macro(define_mode mode, calling_mode 
calling, comp_mode comp)
     while (c == ESCAPE_NEWLINE) {
       if (mode == DEFINE_NORMAL || mode == DEFINE_APPEND)
        mac.append(c);
-      c = get_copy(&n, 1);
+      c = get_copy(&n, true /* is defining */);
     }
     if (bol && c == '.') {
       const char *s = term.contents();
@@ -4593,7 +4593,7 @@ void do_define_macro(define_mode mode, calling_mode 
calling, comp_mode comp)
        mac.append(c);
     }
     bol = (c == '\n');
-    c = get_copy(&n, 1);
+    c = get_copy(&n, true /* is defining */);
   }
 }
 



reply via email to

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