diff options
author | Руслан Ижбулатов <lrn1986@gmail.com> | 2018-06-11 12:29:15 +0000 |
---|---|---|
committer | Руслан Ижбулатов <lrn1986@gmail.com> | 2018-06-11 12:43:14 +0000 |
commit | d2b509fb231d13175dc1af47a36836540a0eea46 (patch) | |
tree | 4a779c81609097efd181f52fa2e4c32ddd85b437 | |
parent | 4f632296a57ee3df809c2a405ac5fb93550aa98e (diff) | |
download | gtk+-lrn/alignfixes.tar.gz |
Fix some alignment issueslrn/alignfixes
* Use GRAPHENE_ALIGN16 to ensure that GtkSnapshotState size
is a multiple of 16
* Use G_STATIC_ASSERT instead of g_return_val_if_fail to make
the wrong size (if it turns out to be wrong) be a compile-time
erorr instead of a runtime one
-rw-r--r-- | gtk/gtksnapshot.c | 2 | ||||
-rw-r--r-- | gtk/gtksnapshotprivate.h | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c index 9d70446791..c8025f7e46 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -67,8 +67,6 @@ gtk_snapshot_state_array_new (void) { GtkRealSnapshotStateArray *array; - g_return_val_if_fail (sizeof (GtkSnapshotState) % 16 == 0, NULL); - array = g_slice_new (GtkRealSnapshotStateArray); array->data = NULL; diff --git a/gtk/gtksnapshotprivate.h b/gtk/gtksnapshotprivate.h index 5ecda2d501..19341a0c32 100644 --- a/gtk/gtksnapshotprivate.h +++ b/gtk/gtksnapshotprivate.h @@ -40,6 +40,7 @@ typedef GskRenderNode * (* GtkSnapshotCollectFunc) (GtkSnapshot *snapshot, GskRenderNode **nodes, guint n_nodes); +GRAPHENE_ALIGN16 struct _GtkSnapshotState { guint start_node_index; guint n_nodes; @@ -91,6 +92,8 @@ struct _GtkSnapshotState { } data; }; +G_STATIC_ASSERT (sizeof (GtkSnapshotState) % 16 == 0); + /* This is a nasty little hack. We typedef GtkSnapshot to the fake object GdkSnapshot * so that we don't need to typecast between them. * After all, the GdkSnapshot only exist so poor language bindings don't trip. Hardcore |