summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoeren Sandmann <sandmann@redhat.com>2005-11-06 23:27:17 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2005-11-06 23:27:17 +0000
commit64b2627c4a69db9ad4f0bc170b08a6bc66412b44 (patch)
treeb2fa9bcb46e4f5012c605009c6108cc5d36f49be
parentc1bfbbf9b8058f20a97905b750da5c52101e2488 (diff)
Make these function call back with GLists rather than GSLists.
Sun Nov 6 18:31:23 2005 Soeren Sandmann <sandmann@redhat.com> * stackstash.c (stack_stash_foreach): * stackstash.c (stack_node_foreach_trace): Make these function call back with GLists rather than GSLists. * profile.c (add_trace_to_tree): Iterate backwards instead of copying the list.
-rw-r--r--ChangeLog9
-rw-r--r--collector.c10
-rw-r--r--profile.c9
-rw-r--r--stackstash.c12
-rw-r--r--stackstash.h4
5 files changed, 27 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 586885d..ad613e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sun Nov 6 18:31:23 2005 Soeren Sandmann <sandmann@redhat.com>
+
+ * stackstash.c (stack_stash_foreach):
+ * stackstash.c (stack_node_foreach_trace): Make these function
+ call back with GLists rather than GSLists.
+
+ * profile.c (add_trace_to_tree): Iterate backwards instead of
+ copying the list.
+
Sun Nov 6 17:06:52 2005 Soeren Sandmann <sandmann@redhat.com>
* profile.c (add_trace_to_tree): Turn this function into a
diff --git a/collector.c b/collector.c
index 4b376c9..e2ea387 100644
--- a/collector.c
+++ b/collector.c
@@ -256,16 +256,16 @@ lookup_symbol (Process *process, gpointer address, GHashTable *unique_symbols)
}
static void
-resolve_symbols (GSList *trace, gint size, gpointer data)
+resolve_symbols (GList *trace, gint size, gpointer data)
{
- GSList *slist;
+ GList *list;
ResolveInfo *info = data;
- Process *process = g_slist_last (trace)->data;
+ Process *process = g_list_last (trace)->data;
GPtrArray *resolved_trace = g_ptr_array_new ();
- for (slist = trace; slist && slist->next; slist = slist->next)
+ for (list = trace; list && list->next; list = list->next)
{
- gpointer address = slist->data;
+ gpointer address = list->data;
char *symbol;
symbol = lookup_symbol (process, address, info->unique_symbols);
diff --git a/profile.c b/profile.c
index c3eb982..d50afab 100644
--- a/profile.c
+++ b/profile.c
@@ -234,17 +234,15 @@ profile_new (StackStash *stash)
}
static void
-add_trace_to_tree (GSList *trace, gint size, gpointer data)
+add_trace_to_tree (GList *trace, gint size, gpointer data)
{
- GSList *list;
+ GList *list;
GPtrArray *nodes_to_unmark = g_ptr_array_new ();
ProfileDescendant *parent = NULL;
int i, len;
ProfileDescendant **tree = data;
- trace = g_slist_reverse (g_slist_copy (trace));
-
- for (list = trace; list != NULL; list = list->next)
+ for (list = g_list_last (trace); list != NULL; list = list->prev)
{
gpointer address = list->data;
ProfileDescendant *match = NULL;
@@ -321,7 +319,6 @@ add_trace_to_tree (GSList *trace, gint size, gpointer data)
}
g_ptr_array_free (nodes_to_unmark, TRUE);
- g_slist_free (trace);
}
ProfileDescendant *
diff --git a/stackstash.c b/stackstash.c
index 1a4c7d3..3a285bc 100644
--- a/stackstash.c
+++ b/stackstash.c
@@ -127,17 +127,20 @@ stack_stash_add_trace (StackStash *stash,
static void
do_callback (StackNode *node,
- const GSList *trace,
+ GList *trace,
StackFunction func,
gpointer data)
{
- GSList link;
+ GList link;
if (!node)
return;
- link.next = (GSList *)trace;
+ if (trace)
+ trace->prev = &link;
+ link.next = trace;
link.data = node->address;
+ link.prev = NULL;
if (node->size)
func (&link, node->size, data);
@@ -159,10 +162,11 @@ stack_node_foreach_trace (StackNode *node,
StackFunction func,
gpointer data)
{
- GSList link;
+ GList link;
link.next = NULL;
link.data = node->address;
+ link.prev = NULL;
if (node->size)
func (&link, node->size, data);
diff --git a/stackstash.h b/stackstash.h
index 0bd8909..0be55c2 100644
--- a/stackstash.h
+++ b/stackstash.h
@@ -41,8 +41,8 @@ struct StackNode
gboolean toplevel;
};
-typedef void (* StackFunction) (GSList *trace,
- gint size,
+typedef void (* StackFunction) (GList *trace,
+ gint size,
gpointer data);
/* Stach */