summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/X11/CallbackI.h6
-rw-r--r--src/Callback.c4
2 files changed, 9 insertions, 1 deletions
diff --git a/include/X11/CallbackI.h b/include/X11/CallbackI.h
index 5d958f4..7d9a689 100644
--- a/include/X11/CallbackI.h
+++ b/include/X11/CallbackI.h
@@ -62,7 +62,11 @@ typedef struct internalCallbackRec {
unsigned short count;
char is_padded; /* contains NULL padding for external form */
char call_state; /* combination of _XtCB{FreeAfter}Calling */
-#ifdef LONG64
+#if __STDC_VERSION__ >= 199901L
+ /* When compiling with C99 or newer, use a flexible member to ensure
+ * padding and alignment for sizeof(). */
+ XtCallbackRec callbacks[];
+#elif defined(LONG64)
unsigned int align_pad; /* padding to align callback list */
#endif
/* XtCallbackList */
diff --git a/src/Callback.c b/src/Callback.c
index 0c4ef5c..fa18436 100644
--- a/src/Callback.c
+++ b/src/Callback.c
@@ -80,7 +80,11 @@ static _Xconst _XtString XtNxtRemoveAllCallback = "xtRemoveAllCallback";
static _Xconst _XtString XtNxtCallCallback = "xtCallCallback";
/* However it doesn't contain a final NULL record */
+#if __STDC_VERSION__ >= 199901L
+#define ToList(p) ((p)->callbacks)
+#else
#define ToList(p) ((XtCallbackList) ((p)+1))
+#endif
static InternalCallbackList *
FetchInternalList(Widget widget,