groff-commit
[Top][All Lists]
Advanced

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

[groff] 14/26: [soelim]: Fix code style nits.


From: G. Branden Robinson
Subject: [groff] 14/26: [soelim]: Fix code style nits.
Date: Thu, 14 Nov 2024 11:54:09 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 12c73a347fbcaae415668e093e7f8e59353484c8
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Nov 12 09:51:03 2024 -0600

    [soelim]: Fix code style nits.
    
    * src/preproc/soelim/soelim.cpp (do_so): Boolify and rename local
      variable, demoting integer `success` to Boolean `is_filename_valid`.
      Use Boolean literals for assignments.
    
      (do_file): Adjust language of diagnostic message.
    
    Also wrap long input line.
---
 ChangeLog                     |  9 +++++++++
 src/preproc/soelim/soelim.cpp | 11 ++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 96770fe01..4cd3466c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-11-12  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [soelim]: Fix code style nits.
+
+       * src/preproc/soelim/soelim.cpp (do_so): Boolify and rename
+       local variable, demoting integer `success` to Boolean
+       `is_filename_valid`.  Use Boolean literals for assignments.
+       (do_file): Adjust language of diagnostic message.
+
 2024-11-12  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [troff]: Slightly refactor.  Shift responsibility for calling
diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp
index 6d120927b..2633c12e3 100644
--- a/src/preproc/soelim/soelim.cpp
+++ b/src/preproc/soelim/soelim.cpp
@@ -122,9 +122,9 @@ void do_so(const char *line)
   while (*p == ' ')
     p++;
   string filename;
-  int success = 1;
+  bool is_filename_valid = true;
   for (const char *q = p;
-       success && *q != '\0' && *q != '\n' && *q != ' ';
+       is_filename_valid && *q != '\0' && *q != '\n' && *q != ' ';
        q++)
     if (*q == '\\') {
       switch (*++q) {
@@ -136,13 +136,13 @@ void do_so(const char *line)
        filename += ' ';
        break;
       default:
-       success = 0;
+       is_filename_valid = false;
        break;
       }
     }
     else
       filename += char(*q);
-  if (success && filename.length() > 0) {
+  if (is_filename_valid && (filename.length() > 0)) {
     filename += '\0';
     const char *fn = current_filename;
     int ln = current_lineno;
@@ -171,7 +171,8 @@ int do_file(const char *filename)
   whole_filename += '\0';
   free(file_name_in_path);
   if (fp == 0) {
-    error("can't open '%1': %2", whole_filename.contents(), strerror(err));
+    error("cannot open '%1': %2", whole_filename.contents(),
+         strerror(err));
     return 0;
   }
   normalize_for_lf(whole_filename);



reply via email to

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