groff-commit
[Top][All Lists]
Advanced

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

[groff] 15/21: [libgroff]: Trivially refactor.


From: G. Branden Robinson
Subject: [groff] 15/21: [libgroff]: Trivially refactor.
Date: Tue, 23 Aug 2022 14:18:42 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit bdc22b6e9e4962f04f2ce311562c3450625e7c8c
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Aug 22 05:38:59 2022 -0500

    [libgroff]: Trivially refactor.
    
    * src/libs/libgroff/error.cpp (do_error_with_file_and_line): Trivially
      refactor.  Use separate string constant for invariant material.  (This
      will make it easier to, for example, store the diagnostic level
      strings in an array that can be indexed by their corresponding `enum`
      type.)
---
 ChangeLog                   | 8 ++++++++
 src/libs/libgroff/error.cpp | 9 +++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ad87559b7..6f93d5ceb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-08-22  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/libs/libgroff/error.cpp (do_error_with_file_and_line):
+       Trivially refactor.  Use separate string constant for invariant
+       material.  (This will make it easier to, for example, store the
+       diagnostic level strings in an array that can be indexed by
+       their corresponding `enum` type.)
+
 2022-08-22  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp (fatal_with_file_and_line)
diff --git a/src/libs/libgroff/error.cpp b/src/libs/libgroff/error.cpp
index 259c30537..b1a4e61c1 100644
--- a/src/libs/libgroff/error.cpp
+++ b/src/libs/libgroff/error.cpp
@@ -65,18 +65,19 @@ static void do_error_with_file_and_line(const char 
*filename,
     fputc(' ', stderr);
   switch (type) {
   case FATAL:
-    fputs("fatal error: ", stderr);
+    fputs("fatal error", stderr);
     break;
   case ERROR:
-    fputs("error: ", stderr);
+    fputs("error", stderr);
     break;
   case WARNING:
-    fputs("warning: ", stderr);
+    fputs("warning", stderr);
     break;
   case DEBUG:
-    fputs("debug: ", stderr);
+    fputs("debug", stderr);
     break;
   }
+  fputs(": ", stderr);
   errprint(format, arg1, arg2, arg3);
   fputc('\n', stderr);
   fflush(stderr);



reply via email to

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