From aaffae57f3b2b2f3d353924934accffea527dc6e Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Tue, 5 Aug 2014 09:00:40 -0700 Subject: Fix outputdots so that it doesn't errantly discard the first line of, e.g., CODE_FRAGMENT. Also fix skip_past_newline to not skip past NUL. * bfd-in2.h: Regenerate. * libcoff.h: Regenerate. doc/ * chew.c (skip_past_newline_1): New function. (outputdots): Call it. (skip_past_newline): Ditto. --- bfd/doc/chew.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'bfd/doc/chew.c') diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c index 0773f9c..9ad88aa 100644 --- a/bfd/doc/chew.c +++ b/bfd/doc/chew.c @@ -265,6 +265,19 @@ skip_white_and_stars (src, idx) return idx; } +static unsigned int +skip_past_newline_1 (ptr, idx) + string_type *ptr; + unsigned int idx; +{ + while (at (ptr, idx) + && at (ptr, idx) != '\n') + idx++; + if (at (ptr, idx) == '\n') + return idx + 1; + return idx; +} + /***********************************************************************/ string_type stack[STACK]; @@ -603,10 +616,12 @@ outputdots () while (at (tos, idx)) { - if (at (tos, idx) == '\n' && at (tos, idx + 1) == '.') + /* Every iteration begins at the start of a line. */ + if (at (tos, idx) == '.') { char c; - idx += 2; + + idx++; while ((c = at (tos, idx)) && c != '\n') { @@ -626,11 +641,13 @@ outputdots () idx++; } } + if (c == '\n') + idx++; catchar (&out, '\n'); } else { - idx++; + idx = skip_past_newline_1 (tos, idx); } } @@ -1095,10 +1112,7 @@ icatstr () static void skip_past_newline () { - while (at (ptr, idx) - && at (ptr, idx) != '\n') - idx++; - idx++; + idx = skip_past_newline_1 (ptr, idx); pc++; } -- cgit v1.1