Use stack allocated variables to avoid taking addresses of bitfields.
authorSoren Sandmann <sandmann@redhat.com>
Mon, 20 Nov 2006 04:11:21 +0000 (04:11 +0000)
committerSøren Sandmann Pedersen <ssp@src.gnome.org>
Mon, 20 Nov 2006 04:11:21 +0000 (04:11 +0000)
2006-11-19  Soren Sandmann <sandmann@redhat.com>

        * profile.c (profile_load): Use stack allocated variables to avoid
        taking addresses of bitfields.

        * stackstash.h (struct StackNode): Store toplevel as bitfield

ChangeLog
profile.c
stackstash.h

index 206c718..2f68214 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2006-11-19  Soren Sandmann <sandmann@redhat.com>
 
+       * profile.c (profile_load): Use stack allocated variables to avoid
+       taking addresses of bitfields.
+
+       * stackstash.h (struct StackNode): Store toplevel as bitfield
+
+2006-11-19  Soren Sandmann <sandmann@redhat.com>
+
        * profile.c (profile_load): Use stack_node_new() o
        (profile_load): Use set_root() instead of new_from_root();
        
index c8f9a85..952674b 100644 (file)
--- a/profile.c
+++ b/profile.c
@@ -206,6 +206,9 @@ profile_load (const char *filename, GError **err)
     for (i = 0; i < n; ++i)
     {
        StackNode *node = stack_node_new ();
+       gboolean toplevel;
+       gint32 size;
+       gint32 total;
        
        sfile_begin_get_record (input, "node");
        
@@ -213,9 +216,13 @@ profile_load (const char *filename, GError **err)
        sfile_get_pointer (input, "siblings", (gpointer *)&node->siblings);
        sfile_get_pointer (input, "children", (gpointer *)&node->children);
        sfile_get_pointer (input, "parent", (gpointer *)&node->parent);
-       sfile_get_integer (input, "total", &node->total);
-       sfile_get_integer (input, "self", (gint32 *)&node->size);
-       sfile_get_integer (input, "toplevel", &node->toplevel);
+       sfile_get_integer (input, "total", &total);
+       sfile_get_integer (input, "self", (gint32 *)&size);
+       sfile_get_integer (input, "toplevel", &toplevel);
+
+       node->total = total;
+       node->toplevel = toplevel;
+       node->size = size;
        
        sfile_end_get (input, "node", node);
        
index d926a3f..c6f7bda 100644 (file)
@@ -28,16 +28,16 @@ typedef struct StackNode StackNode;
 struct StackNode
 {
     gpointer   address;
-    int                total;
-    int                size;
+
+    guint      total : 32;
+    guint      size : 31;
+    guint      toplevel : 1;
     
     StackNode *        parent;
     StackNode *        siblings;
     StackNode *        children;
 
     StackNode * next;
-
-    gboolean   toplevel;
 };
 
 typedef void (* StackFunction) (GList   *trace,