diff options
| author | Jan Kratochvil <[email protected]> | 2012-10-11 21:47:26 +0200 |
|---|---|---|
| committer | Jan Kratochvil <[email protected]> | 2012-10-11 21:47:26 +0200 |
| commit | 69a2852e1d5661bc042dcc90c16e9aa7777c7340 (patch) | |
| tree | d8cd4582151341e0466a94205e5536f2539c0ec9 /src/readelf.c | |
| parent | 960a6aff19a0537c59b84136d68e41a6ea8638fb (diff) | |
src/
2012-10-11 Jan Kratochvil <[email protected]>
* readelf.c (handle_core_item) <b>: Make run an outer block variable.
Increase run only if LASTBIT != 0. Print last element only if RUN > 0.
Signed-off-by: Jan Kratochvil <[email protected]>
Diffstat (limited to 'src/readelf.c')
| -rw-r--r-- | src/readelf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/readelf.c b/src/readelf.c index 5d167ebc..470af4d9 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -7515,19 +7515,19 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc, } unsigned int lastbit = 0; + unsigned int run = 0; for (const unsigned int *i = data; (void *) i < data + count * size; ++i) { unsigned int bit = ((void *) i - data) * 8; unsigned int w = negate ? ~*i : *i; - unsigned int run = 0; while (w != 0) { int n = ffs (w); w >>= n; bit += n; - if (lastbit + 1 == bit) + if (lastbit != 0 && lastbit + 1 == bit) ++run; else { @@ -7543,8 +7543,8 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc, lastbit = bit; } } - if (lastbit > 0 && lastbit + 1 != nbits) - p += sprintf (p, "-%u", nbits - bias); + if (lastbit > 0 && run > 0 && lastbit + 1 != nbits) + p += sprintf (p, "-%u", lastbit - bias); colno = print_core_item (colno, ',', ITEM_WRAP_COLUMN, 0, item->name, 4 + nbits * 4, |
