groff-commit
[Top][All Lists]
Advanced

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

[groff] 02/07: [groff]: Partially revert commit 64dc40d23a.


From: G. Branden Robinson
Subject: [groff] 02/07: [groff]: Partially revert commit 64dc40d23a.
Date: Sun, 26 Jun 2022 09:24:00 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 4848e014cb1e6237bdb2657708cebf1864c54fc7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Jun 22 15:06:20 2022 -0500

    [groff]: Partially revert commit 64dc40d23a.
    
    * src/roff/groff/groff.cpp (handle_unknown_desc_command): Partially
      revert commit 64dc40d23a, 19 June.  I forgot to save and restore the
      previous values of the globals `current_filename` and
      `current_lineno`, and, noticing that this function has 3 return paths,
      decided that it's cheaper just to go back to
      `error_with_file_and_line()`.
---
 ChangeLog                |  9 +++++++++
 src/roff/groff/groff.cpp | 18 ++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2443e1b3..df46a921 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-06-22  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/groff/groff.cpp (handle_unknown_desc_command):
+       Partially revert commit 64dc40d23a, 19 June.  I forgot to save
+       and restore the previous values of the globals
+       `current_filename` and `current_lineno`, and, noticing that this
+       function has 3 return paths, decided that it's cheaper just to
+       go back to `error_with_file_and_line()`.
+
 2022-06-21  Deri James  <deri@chuzzlewit.myzen.co.uk>
 
        [gropdf]: Add more search paths to the Foundry file.
diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp
index 3556cb2f..98ee296a 100644
--- a/src/roff/groff/groff.cpp
+++ b/src/roff/groff/groff.cpp
@@ -554,11 +554,10 @@ const char *xbasename(const char *s)
 void handle_unknown_desc_command(const char *command, const char *arg,
                                 const char *filename, int lineno)
 {
-  current_filename = filename;
-  current_lineno = lineno;
   if (strcmp(command, "print") == 0) {
     if (arg == 0 /* nullptr */)
-      error("'print' directive requires an argument");
+      error_with_file_and_line(filename, lineno, "'print' directive"
+                              " requires an argument");
     else
       spooler = xstrdup(arg);
   }
@@ -568,8 +567,9 @@ void handle_unknown_desc_command(const char *command, const 
char *arg,
     else {
       for (const char *p = arg; *p; p++)
        if (csspace(*p)) {
-         error("invalid 'prepro' directive argument '%1':"
-               " program name required", arg);
+         error_with_file_and_line(filename, lineno, "invalid 'prepro'"
+                                  " directive argument '%1': program"
+                                  " name required", arg);
          return;
        }
       predriver = xstrdup(arg);
@@ -577,12 +577,14 @@ void handle_unknown_desc_command(const char *command, 
const char *arg,
   }
   if (strcmp(command, "postpro") == 0) {
     if (arg == 0 /* nullptr */)
-      error("'postpro' directive requires an argument");
+      error_with_file_and_line(filename, lineno, "'postpro' directive"
+                              " requires an argument");
     else {
       for (const char *p = arg; *p; p++)
        if (csspace(*p)) {
-         error("invalid 'postpro' directive argument '%1':"
-               " program name required", arg);
+         error_with_file_and_line(filename, lineno, "invalid 'postpro'"
+                                  " directive argument '%1': program"
+                                  " name required", arg);
          return;
        }
       postdriver = xstrdup(arg);



reply via email to

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