Update comment for VG_(am_find_nsegment) to match the code.
Likewise for VG_(am_next_nsegment). Also make the code similar to
VG_(am_find_nsegment) for easier comprehension.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14937 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c
index 04611ff..6d26ec4 100644
--- a/coregrind/m_aspacemgr/aspacemgr-linux.c
+++ b/coregrind/m_aspacemgr/aspacemgr-linux.c
@@ -1185,10 +1185,7 @@
}
-
-/* Finds the segment containing 'a'. Only returns file/anon/resvn
- segments. This returns a 'NSegment const *' - a pointer to
- readonly data. */
+/* Finds the segment containing 'a'. Only returns non-SkFree segments. */
NSegment const * VG_(am_find_nsegment) ( Addr a )
{
Int i = find_nsegment_idx(a);
@@ -1211,8 +1208,7 @@
}
-/* Find the next segment along from 'here', if it is a file/anon/resvn
- segment. */
+/* 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);
@@ -1226,14 +1222,10 @@
if (i < 0)
return NULL;
}
- switch (nsegments[i].kind) {
- case SkFileC: case SkFileV: case SkShmC:
- case SkAnonC: case SkAnonV: case SkResvn:
- return &nsegments[i];
- default:
- break;
- }
- return NULL;
+ if (nsegments[i].kind == SkFree)
+ return NULL;
+ else
+ return &nsegments[i];
}