]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Update comment for VG_(am_find_nsegment) to match the code.
authorFlorian Krohm <florian@eich-krohm.de>
Mon, 16 Feb 2015 23:04:53 +0000 (23:04 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Mon, 16 Feb 2015 23:04:53 +0000 (23:04 +0000)
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

coregrind/m_aspacemgr/aspacemgr-linux.c

index 04611ff4d40e8a94ccd0c1560621c08902ca016c..6d26ec4a61eeabc91de8acdf72d7ca5ac0d06959 100644 (file)
@@ -1185,10 +1185,7 @@ inline static Int find_nsegment_idx ( Addr a )
 }
 
 
-
-/* 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 @@ static Int segAddr_to_index ( const NSegment* seg )
 }
 
 
-/* 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 @@ NSegment const * VG_(am_next_nsegment) ( const NSegment* here, Bool fwds )
       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];
 }