aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-07-05 15:01:17 +0200
committerDavid Robillard <d@drobilla.net>2020-07-05 18:47:39 +0200
commitd70aa80d71299c24ebd71537cfd620eff2b7e50d (patch)
tree2b1606491ac1f7c6a4063549fb81f5597d0b3750
parentabf44b129480937cd31d6585183d266a496ee2a4 (diff)
Improve struct packing
Unfortunately there is no warning like Wpadded but only for internal padding, so that can't be turned on, but if there was, after this commit the build would be clean with it. Maybe some day...
-rw-r--r--examples/pugl_cairo_demo.c2
-rw-r--r--examples/pugl_cursor_demo.c2
-rw-r--r--examples/pugl_embed_demo.c6
-rw-r--r--examples/pugl_shader_demo.c2
-rw-r--r--examples/pugl_window_demo.c4
-rw-r--r--pugl/detail/types.h2
-rw-r--r--pugl/detail/x11.h8
-rw-r--r--test/test_redisplay.c6
-rw-r--r--test/test_show_hide.c6
-rw-r--r--test/test_timer.c6
-rw-r--r--test/test_update.c6
11 files changed, 25 insertions, 25 deletions
diff --git a/examples/pugl_cairo_demo.c b/examples/pugl_cairo_demo.c
index 2e0b9c7..5fe0661 100644
--- a/examples/pugl_cairo_demo.c
+++ b/examples/pugl_cairo_demo.c
@@ -33,8 +33,8 @@
#include <string.h>
typedef struct {
- PuglTestOptions opts;
PuglWorld* world;
+ PuglTestOptions opts;
unsigned framesDrawn;
int quit;
bool entered;
diff --git a/examples/pugl_cursor_demo.c b/examples/pugl_cursor_demo.c
index 244d22f..03ab5da 100644
--- a/examples/pugl_cursor_demo.c
+++ b/examples/pugl_cursor_demo.c
@@ -32,8 +32,8 @@ static const int N_ROWS = 2;
static const int N_COLS = 4;
typedef struct {
- PuglTestOptions opts;
PuglWorld* world;
+ PuglTestOptions opts;
bool quit;
} PuglTestApp;
diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c
index e21dd55..774ac77 100644
--- a/examples/pugl_embed_demo.c
+++ b/examples/pugl_embed_demo.c
@@ -41,14 +41,14 @@ typedef struct
PuglWorld* world;
PuglView* parent;
PuglView* child;
- bool continuous;
- int quit;
double xAngle;
double yAngle;
- float dist;
double lastMouseX;
double lastMouseY;
double lastDrawTime;
+ float dist;
+ int quit;
+ bool continuous;
bool mouseEntered;
bool verbose;
bool reversing;
diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c
index 15e1943..50afb37 100644
--- a/examples/pugl_shader_demo.c
+++ b/examples/pugl_shader_demo.c
@@ -61,9 +61,9 @@ typedef struct
typedef struct
{
- PuglTestOptions opts;
PuglWorld* world;
PuglView* view;
+ PuglTestOptions opts;
size_t numRects;
Rect* rects;
Program drawRect;
diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c
index 9343c9c..f326f21 100644
--- a/examples/pugl_window_demo.c
+++ b/examples/pugl_window_demo.c
@@ -34,18 +34,18 @@ typedef struct {
PuglView* view;
double xAngle;
double yAngle;
- float dist;
double lastMouseX;
double lastMouseY;
double lastDrawTime;
+ float dist;
bool entered;
} CubeView;
typedef struct {
PuglWorld* world;
CubeView cubes[2];
- bool continuous;
int quit;
+ bool continuous;
bool verbose;
} PuglTestApp;
diff --git a/pugl/detail/types.h b/pugl/detail/types.h
index 0b0332c..edd2bd0 100644
--- a/pugl/detail/types.h
+++ b/pugl/detail/types.h
@@ -63,9 +63,9 @@ struct PuglViewImpl {
PuglBlob clipboard;
PuglNativeView parent;
uintptr_t transientParent;
- PuglHints hints;
PuglRect frame;
PuglEventConfigure lastConfigure;
+ PuglHints hints;
int defaultWidth;
int defaultHeight;
int minWidth;
diff --git a/pugl/detail/x11.h b/pugl/detail/x11.h
index 47d9225..cf647ed 100644
--- a/pugl/detail/x11.h
+++ b/pugl/detail/x11.h
@@ -61,16 +61,16 @@ struct PuglWorldInternalsImpl {
struct PuglInternalsImpl {
Display* display;
- int screen;
XVisualInfo* vi;
Window win;
-#ifdef HAVE_XCURSOR
- unsigned cursorShape;
-#endif
XIC xic;
PuglSurface* surface;
PuglEvent pendingConfigure;
PuglEvent pendingExpose;
+ int screen;
+#ifdef HAVE_XCURSOR
+ unsigned cursorShape;
+#endif
};
static inline PuglStatus
diff --git a/test/test_redisplay.c b/test/test_redisplay.c
index 108a433..91b606f 100644
--- a/test/test_redisplay.c
+++ b/test/test_redisplay.c
@@ -47,9 +47,9 @@ typedef enum {
typedef struct
{
- PuglTestOptions opts;
PuglWorld* world;
PuglView* view;
+ PuglTestOptions opts;
State state;
} PuglTest;
@@ -100,9 +100,9 @@ onEvent(PuglView* view, const PuglEvent* event)
int
main(int argc, char** argv)
{
- PuglTest app = {puglParseTestOptions(&argc, &argv),
- puglNewWorld(PUGL_PROGRAM, 0),
+ PuglTest app = {puglNewWorld(PUGL_PROGRAM, 0),
NULL,
+ puglParseTestOptions(&argc, &argv),
START};
// Set up view
diff --git a/test/test_show_hide.c b/test/test_show_hide.c
index 7b6d4f4..ebbbee9 100644
--- a/test/test_show_hide.c
+++ b/test/test_show_hide.c
@@ -41,9 +41,9 @@ typedef enum {
} State;
typedef struct {
- PuglTestOptions opts;
PuglWorld* world;
PuglView* view;
+ PuglTestOptions opts;
State state;
} PuglTest;
@@ -104,9 +104,9 @@ tick(PuglWorld* world)
int
main(int argc, char** argv)
{
- PuglTest test = {puglParseTestOptions(&argc, &argv),
- puglNewWorld(PUGL_PROGRAM, 0),
+ PuglTest test = {puglNewWorld(PUGL_PROGRAM, 0),
NULL,
+ puglParseTestOptions(&argc, &argv),
START};
// Set up view
diff --git a/test/test_timer.c b/test/test_timer.c
index 2a0b67f..d567da0 100644
--- a/test/test_timer.c
+++ b/test/test_timer.c
@@ -55,9 +55,9 @@ typedef enum {
} State;
typedef struct {
- PuglTestOptions opts;
PuglWorld* world;
PuglView* view;
+ PuglTestOptions opts;
size_t numAlarms;
State state;
} PuglTest;
@@ -97,9 +97,9 @@ roundPeriod(const double period)
int
main(int argc, char** argv)
{
- PuglTest app = {puglParseTestOptions(&argc, &argv),
- puglNewWorld(PUGL_PROGRAM, 0),
+ PuglTest app = {puglNewWorld(PUGL_PROGRAM, 0),
NULL,
+ puglParseTestOptions(&argc, &argv),
0,
START};
diff --git a/test/test_update.c b/test/test_update.c
index 65d74d6..bdcb28b 100644
--- a/test/test_update.c
+++ b/test/test_update.c
@@ -44,9 +44,9 @@ typedef enum {
} State;
typedef struct {
- PuglTestOptions opts;
PuglWorld* world;
PuglView* view;
+ PuglTestOptions opts;
State state;
} PuglTest;
@@ -90,9 +90,9 @@ onEvent(PuglView* view, const PuglEvent* event)
int
main(int argc, char** argv)
{
- PuglTest app = {puglParseTestOptions(&argc, &argv),
- puglNewWorld(PUGL_PROGRAM, 0),
+ PuglTest app = {puglNewWorld(PUGL_PROGRAM, 0),
NULL,
+ puglParseTestOptions(&argc, &argv),
START};
// Set up view