summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorG. Branden Robinson <g.branden.robinson@gmail.com>2020-04-11 19:12:49 +1000
committerG. Branden Robinson <g.branden.robinson@gmail.com>2020-04-11 19:12:49 +1000
commit1ff4903b9c04a2504da938036e07e2b7d95a8147 (patch)
treea971d8d92bd5929af7ab57dc9a1014ea57e74372
parentfaf49609f480bcae418a1173fe89fa7c6d981aeb (diff)
downloadgroff-git-1ff4903b9c04a2504da938036e07e2b7d95a8147.tar.gz
Tweak minor details of #58153 fix.
* ChangeLog: Explain root-clause analysis more completely. * src/roff/troff/input.cpp: Use same brief-scope variable names as earlier code for better continuity.
-rw-r--r--ChangeLog7
-rw-r--r--src/roff/troff/input.cpp8
2 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 07d5fbe8b..e4954897d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -60,7 +60,12 @@
get_location() for its side effect of rewriting a filename of
"-" to "<standard input>", for consistency with other diagnostic
messages. (In this class, this member function always returns
- 1, so ignore the return value.)
+ 1, so ignore the return value. This fact is an essential part
+ of what led to the bug; the conditional
+ p && !p->get_location(0, &f, &n)
+ which appeared in the for loop of the old
+ input_stack::backtrace() would always evaluate to false when a
+ node of the file_iterator class was encountered.)
(input_stack::backtrace): Replace member function body with that
of input_stack::backtrace_all().
(input_stack::backtrace_all): Delete.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index f35fcbf3c..26394ade0 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -401,13 +401,13 @@ int file_iterator::get_location(int /*allow_macro*/,
void file_iterator::backtrace()
{
- const char *fn;
- int l;
+ const char *f;
+ int n;
// Get side effect of filename rewrite if stdin.
- (void) get_location(0, &fn, &l);
+ (void) get_location(0, &f, &n);
if (program_name)
fprintf(stderr, "%s: ", program_name);
- errprint("backtrace: %3 '%1':%2\n", fn, l, popened ? "pipe" : "file");
+ errprint("backtrace: %3 '%1':%2\n", f, n, popened ? "pipe" : "file");
}
int file_iterator::set_location(const char *f, int ln)