aboutsummaryrefslogtreecommitdiff
path: root/bfd/doc
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2014-08-05 09:00:40 -0700
committerDoug Evans <dje@google.com>2014-08-05 09:00:40 -0700
commitaaffae57f3b2b2f3d353924934accffea527dc6e (patch)
treec437650704afea858954514f305fcc177b6a613f /bfd/doc
parente034b2cc9d2125f80dabb698271a346cbcff8d76 (diff)
downloadgdb-aaffae57f3b2b2f3d353924934accffea527dc6e.zip
gdb-aaffae57f3b2b2f3d353924934accffea527dc6e.tar.gz
gdb-aaffae57f3b2b2f3d353924934accffea527dc6e.tar.bz2
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.
Diffstat (limited to 'bfd/doc')
-rw-r--r--bfd/doc/ChangeLog6
-rw-r--r--bfd/doc/chew.c28
2 files changed, 27 insertions, 7 deletions
diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog
index 3387732..e2987ed 100644
--- a/bfd/doc/ChangeLog
+++ b/bfd/doc/ChangeLog
@@ -1,3 +1,9 @@
+2014-08-05 Doug Evans <dje@google.com>
+
+ * chew.c (skip_past_newline_1): New function.
+ (outputdots): Call it.
+ (skip_past_newline): Ditto.
+
2014-08-05 Alan Modra <amodra@gmail.com>
* chew.c (print_stack_level, main): Cast result of pointer
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++;
}