Use stack allocated variables to avoid taking addresses of bitfields.

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
This commit is contained in:
Soren Sandmann
2006-11-20 04:11:21 +00:00
committed by Søren Sandmann Pedersen
parent 0b718ee95c
commit cce917856b
3 changed files with 21 additions and 7 deletions

View File

@ -1,3 +1,10 @@
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

View File

@ -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);

View 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,