groff-commit
[Top][All Lists]
Advanced

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

[groff] 72/115: [troff]: Revise ordinary character descriptions.


From: G. Branden Robinson
Subject: [groff] 72/115: [troff]: Revise ordinary character descriptions.
Date: Thu, 1 Jun 2023 10:46:12 -0400 (EDT)

gbranden pushed a commit to branch branden-2022-06-01
in repository groff.

commit 3585e6c9f9c5af92b082179788cbeb746f762713
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Apr 2 10:47:33 2023 -0500

    [troff]: Revise ordinary character descriptions.
    
    * src/roff/troff/input.cpp (token::description): Revise construction of
      description of printable ordinary input characters (U+0021 through
      U+007E).  This is to faciliate better diagnostics from the `rchar`
      request in the future.  See Savannah #63985.
---
 ChangeLog                | 8 ++++++++
 src/roff/troff/input.cpp | 8 +++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d3da1d2b..b0fabd6b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-04-02  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/input.cpp (token::description): Revise
+       construction of description of printable ordinary input
+       characters (U+0021 through U+007E).  This is to faciliate better
+       diagnostics from the `rchar` request in the future.  See
+       Savannah #63985.
+
 2023-04-01  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp (chop_macro)
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 44f422723..2a86c9c01 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2402,7 +2402,8 @@ bool token::usable_as_delimiter(bool report_error)
 
 const char *token::description()
 {
-  static char buf[4];
+  const int bufsz = strlen("character 'x'") + 1;
+  static char buf[bufsz];
   switch (type) {
   case TOKEN_BACKSPACE:
     return "a backspace character";
@@ -2410,10 +2411,7 @@ const char *token::description()
     if (c == INPUT_DELETE)
       return "a delete character";
     else {
-      buf[0] = '\'';
-      buf[1] = c;
-      buf[2] = '\'';
-      buf[3] = '\0';
+      (void) snprintf(buf, bufsz, "character '%c'", c);
       return buf;
     }
   case TOKEN_DUMMY:



reply via email to

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