groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/07: [groff]: Refactor to skip some string comparisons.


From: G. Branden Robinson
Subject: [groff] 03/07: [groff]: Refactor to skip some string comparisons.
Date: Sun, 26 Jun 2022 09:24:00 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit df4daa3d3f82dcaf427c5a106f636e8d715dfab9
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Jun 22 15:15:18 2022 -0500

    [groff]: Refactor to skip some string comparisons.
    
    * src/roff/groff/groff.cpp (handle_unknown_desc_command): Refactor to
      skip unnecessary string comparisons.  We explicitly return in the
      final case instead of falling off the end of this void function for
      consistency if additional cases are added.
---
 ChangeLog                | 7 +++++++
 src/roff/groff/groff.cpp | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index df46a921..97078d41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-06-22  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/groff/groff.cpp (handle_unknown_desc_command):
+       Refactor to skip unnecessary string comparisons.  We explicitly
+       return in the final case instead of falling off the end of this
+       void function for consistency if additional cases are added.
+
 2022-06-22  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/groff/groff.cpp (handle_unknown_desc_command):
diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp
index 98ee296a..6315f4f9 100644
--- a/src/roff/groff/groff.cpp
+++ b/src/roff/groff/groff.cpp
@@ -560,6 +560,7 @@ void handle_unknown_desc_command(const char *command, const 
char *arg,
                               " requires an argument");
     else
       spooler = xstrdup(arg);
+    return;
   }
   if (strcmp(command, "prepro") == 0) {
     if (arg == 0 /* nullptr */)
@@ -570,10 +571,10 @@ void handle_unknown_desc_command(const char *command, 
const char *arg,
          error_with_file_and_line(filename, lineno, "invalid 'prepro'"
                                   " directive argument '%1': program"
                                   " name required", arg);
-         return;
        }
       predriver = xstrdup(arg);
     }
+    return;
   }
   if (strcmp(command, "postpro") == 0) {
     if (arg == 0 /* nullptr */)
@@ -589,6 +590,7 @@ void handle_unknown_desc_command(const char *command, const 
char *arg,
        }
       postdriver = xstrdup(arg);
     }
+    return;
   }
 }
 



reply via email to

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