From d17f7b365cf3896b3129b9077d55b3154fc43131 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 2 May 2017 14:25:43 -0400 Subject: [PATCH] solib-target: Remove local variables Now that we use std::vector, these local variables are not very useful. They're not much shorter than the expressions they stand for. gdb/ChangeLog: * solib-target.c (solib_target_relocate_section_addresses): Remove num_section_bases, num_bases, segment_bases variables. --- gdb/ChangeLog | 5 +++++ gdb/solib-target.c | 22 +++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b82cfd53a89..f4415854889 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-05-02 Simon Marchi + + * solib-target.c (solib_target_relocate_section_addresses): + Remove num_section_bases, num_bases, segment_bases variables. + 2017-05-02 Simon Marchi * common/gdb_vecs.h (DEF_VEC_I (CORE_ADDR)): Remove. diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 2e9b96273d0..71a0da322c7 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -347,7 +347,6 @@ solib_target_relocate_section_addresses (struct so_list *so, { int i; asection *sect; - int num_section_bases = li->section_bases.size (); int num_alloc_sections = 0; for (i = 0, sect = so->abfd->sections; @@ -356,7 +355,7 @@ solib_target_relocate_section_addresses (struct so_list *so, if ((bfd_get_section_flags (so->abfd, sect) & SEC_ALLOC)) num_alloc_sections++; - if (num_alloc_sections != num_section_bases) + if (num_alloc_sections != li->section_bases.size ()) warning (_("\ Could not relocate shared library \"%s\": wrong number of ALLOC sections"), so->so_name); @@ -407,37 +406,34 @@ Could not relocate shared library \"%s\": no segments"), so->so_name); { ULONGEST orig_delta; int i; - int num_bases; - CORE_ADDR *segment_bases; - - num_bases = li->segment_bases.size (); - segment_bases = li->segment_bases.data (); if (!symfile_map_offsets_to_segments (so->abfd, data, li->offsets, - num_bases, segment_bases)) + li->segment_bases.size (), + li->segment_bases.data ())) warning (_("\ Could not relocate shared library \"%s\": bad offsets"), so->so_name); /* Find the range of addresses to report for this library in "info sharedlibrary". Report any consecutive segments which were relocated as a single unit. */ - gdb_assert (num_bases > 0); - orig_delta = segment_bases[0] - data->segment_bases[0]; + gdb_assert (li->segment_bases.size () > 0); + orig_delta = li->segment_bases[0] - data->segment_bases[0]; for (i = 1; i < data->num_segments; i++) { /* If we have run out of offsets, assume all remaining segments have the same offset. */ - if (i >= num_bases) + if (i >= li->segment_bases.size ()) continue; /* If this segment does not have the same offset, do not include it in the library's range. */ - if (segment_bases[i] - data->segment_bases[i] != orig_delta) + if (li->segment_bases[i] - data->segment_bases[i] + != orig_delta) break; } - so->addr_low = segment_bases[0]; + so->addr_low = li->segment_bases[0]; so->addr_high = (data->segment_bases[i - 1] + data->segment_sizes[i - 1] + orig_delta); -- 2.30.2