[sysprof/newui: 8/24] Fix bug in move to front



commit 789b0cb2cf731ae5f02f9386454096cded45b9f5
Author: SÃren Sandmann Pedersen <sandmann daimi au dk>
Date:   Tue Nov 9 08:29:03 2010 -0500

    Fix bug in move to front

 tracker.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/tracker.c b/tracker.c
index d8dc2d3..0dbb1e6 100644
--- a/tracker.c
+++ b/tracker.c
@@ -415,15 +415,19 @@ process_locate_map (process_t *process, gulong addr)
     {
 	map_t *map = &g_array_index (maps, map_t, i);
 
-	if (addr >= map->start && addr < map->end && i > 0)
+	if (addr >= map->start && addr < map->end)
 	{
-	    map_t tmp = *map;
-	    
-	    memmove (&(g_array_index (maps, map_t, 1)),
-		     &(g_array_index (maps, map_t, 0)),
-		     i * sizeof (map_t));
-
-	    g_array_index (maps, map_t, 0) = tmp;
+	    if (i > 0)
+	    {
+		/* Move to front */
+		map_t tmp = *map;
+		
+		memmove (&(g_array_index (maps, map_t, 1)),
+			 &(g_array_index (maps, map_t, 0)),
+			 i * sizeof (map_t));
+		
+		g_array_index (maps, map_t, 0) = tmp;
+	    }
 	    
 	    return &g_array_index (maps, map_t, 0);
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]