[sysprof] alignment: set alignment on structs



commit 63579451b5073b9ce3e7167bea5db2872d9c353d
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 15 22:18:09 2016 -0800

    alignment: set alignment on structs
    
    This uses an alternate idea for setting the structure alignments. Lets
    see if this silents the ARM builder cast alignment issues.
    
    GSlice (which is what is used for GObjects) guarantees a 2-pointer size
    allocation, which means we can be ensured that the alignment is at least
    8 bytes.

 lib/sp-visualizer-ticks.c |    2 +-
 lib/sp-visualizer-ticks.h |    2 ++
 lib/sp-zoom-manager.c     |    6 +++---
 lib/sp-zoom-manager.h     |    2 ++
 4 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/lib/sp-visualizer-ticks.c b/lib/sp-visualizer-ticks.c
index 00b27b9..fb3b638 100644
--- a/lib/sp-visualizer-ticks.c
+++ b/lib/sp-visualizer-ticks.c
@@ -34,7 +34,7 @@ struct _SpVisualizerTicks
   gint64 epoch;
   gint64 begin_time;
   gint64 end_time;
-} __attribute__((aligned(8)));
+};
 
 enum {
   TICK_MINUTES,
diff --git a/lib/sp-visualizer-ticks.h b/lib/sp-visualizer-ticks.h
index 5efeee3..ed7d282 100644
--- a/lib/sp-visualizer-ticks.h
+++ b/lib/sp-visualizer-ticks.h
@@ -25,6 +25,8 @@ G_BEGIN_DECLS
 
 #define SP_TYPE_VISUALIZER_TICKS (sp_visualizer_ticks_get_type())
 
+typedef struct _SpVisualizerTicks SpVisualizerTicks __attribute__((aligned(8)));
+
 G_DECLARE_FINAL_TYPE (SpVisualizerTicks, sp_visualizer_ticks, SP, VISUALIZER_TICKS, GtkDrawingArea)
 
 GtkWidget *sp_visualizer_ticks_new            (void);
diff --git a/lib/sp-zoom-manager.c b/lib/sp-zoom-manager.c
index 61aa464..b7c5baf 100644
--- a/lib/sp-zoom-manager.c
+++ b/lib/sp-zoom-manager.c
@@ -32,7 +32,7 @@ struct _SpZoomManager
   gdouble min_zoom;
   gdouble max_zoom;
   gdouble zoom;
-} __attribute__((aligned(8)));
+};
 
 enum {
   PROP_0,
@@ -108,7 +108,7 @@ sp_zoom_manager_get_property (GObject    *object,
                               GValue     *value,
                               GParamSpec *pspec)
 {
-  SpZoomManager *self = (SpZoomManager *)object;
+  SpZoomManager *self = SP_ZOOM_MANAGER (object);
 
   switch (prop_id)
     {
@@ -143,7 +143,7 @@ sp_zoom_manager_set_property (GObject      *object,
                               const GValue *value,
                               GParamSpec   *pspec)
 {
-  SpZoomManager *self = (SpZoomManager *)object;
+  SpZoomManager *self = SP_ZOOM_MANAGER (object);
 
   switch (prop_id)
     {
diff --git a/lib/sp-zoom-manager.h b/lib/sp-zoom-manager.h
index ca2a786..719b3c0 100644
--- a/lib/sp-zoom-manager.h
+++ b/lib/sp-zoom-manager.h
@@ -25,6 +25,8 @@ G_BEGIN_DECLS
 
 #define SP_TYPE_ZOOM_MANAGER (sp_zoom_manager_get_type())
 
+typedef struct _SpZoomManager SpZoomManager __attribute__((aligned(8)));
+
 G_DECLARE_FINAL_TYPE (SpZoomManager, sp_zoom_manager, SP, ZOOM_MANAGER, GObject)
 
 SpZoomManager *sp_zoom_manager_new              (void);


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