From c98bcc796529b7ec56f369c743748d9ff32abf61 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 4 Aug 2007 17:06:14 +0000 Subject: [PATCH] Minimal cleanups of large merge. --- src/ChangeLog | 6 ++++++ src/readelf.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d94dcfe1c..505abb429 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2007-08-04 Ulrich Drepper + + * readelf.c (hex_dump): Use isprint to determine whether to print + character itself or full stop character. + (dump_data): No need to check endp for NULL after strtol call. + 2007-08-03 Roland McGrath * readelf.c (print_string_sections): New variable. diff --git a/src/readelf.c b/src/readelf.c index 153176c2a..e8b0bb4a7 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -5071,7 +5072,7 @@ hex_dump (const uint8_t *data, size_t len) for (size_t i = 0; i < chunk; ++i) { unsigned char b = data[pos + i]; - printf ("%c", b > ' ' && b < 0x7f ? b : '.'); + printf ("%c", isprint (b) ? b : '.'); } putchar ('\n'); @@ -5096,7 +5097,7 @@ dump_data (Ebl *ebl) char *endp = NULL; unsigned long int shndx = strtoul (a->arg, &endp, 0); - if (endp != NULL && endp != a->arg && *endp == '\0') + if (endp != a->arg && *endp == '\0') { scn = elf_getscn (ebl->elf, shndx); if (scn == NULL) -- 2.47.2