|
From: <sv...@va...> - 2015-05-13 16:03:36
|
Author: florian
Date: Wed May 13 17:03:29 2015
New Revision: 15225
Log:
Remove segAddr_to_index as its behaviour is undefined.
Modified:
branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c
Modified: branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c Wed May 13 17:03:29 2015
@@ -1124,33 +1124,21 @@
}
-/* Map segment pointer to segment index. */
-static Int segAddr_to_index ( const NSegment* seg )
-{
- aspacem_assert(seg >= &nsegments[0] && seg < &nsegments[nsegments_used]);
-
- return seg - &nsegments[0];
-}
-
-
/* Find the next segment along from 'here', if it is a non-SkFree segment. */
NSegment const * VG_(am_next_nsegment) ( const NSegment* here, Bool fwds )
{
- Int i = segAddr_to_index(here);
+ const NSegment *next;
if (fwds) {
- i++;
- if (i >= nsegments_used)
+ next = here + 1;
+ if (next >= nsegments + nsegments_used)
return NULL;
} else {
- i--;
- if (i < 0)
+ if (here == nsegments)
return NULL;
+ next = here - 1;
}
- if (nsegments[i].kind == SkFree)
- return NULL;
- else
- return &nsegments[i];
+ return (next->kind == SkFree) ? NULL : next;
}
|