aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sqliteInt.h9
-rw-r--r--src/vdbeInt.h2
2 files changed, 9 insertions, 2 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index af7ed4a4c..994a3864c 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -765,7 +765,7 @@
** ourselves.
*/
#ifndef offsetof
-#define offsetof(STRUCTURE,FIELD) ((size_t)((char*)&((STRUCTURE*)0)->FIELD))
+# define offsetof(ST,M) ((size_t)((char*)&((ST*)0)->M - (char*)0))
#endif
/*
@@ -2661,6 +2661,13 @@ struct KeyInfo {
/* The size (in bytes) of a KeyInfo object with up to N fields */
#define SZ_KEYINFO(N) (offsetof(KeyInfo,aColl) + (N)*sizeof(CollSeq*))
+/* The size of a bare KeyInfo with no aColl[] entries */
+#if FLEXARRAY+1 > 1
+# define SZ_KEYINFO_0 offsetof(KeyInfo,aColl)
+#else
+# define SZ_KEYINFO_0 sizeof(KeyInfo)
+#endif
+
/*
** Allowed bit values for entries in the KeyInfo.aSortFlags[] array.
*/
diff --git a/src/vdbeInt.h b/src/vdbeInt.h
index 13262cd4e..0faa32747 100644
--- a/src/vdbeInt.h
+++ b/src/vdbeInt.h
@@ -557,7 +557,7 @@ struct PreUpdate {
Table *pTab; /* Schema object being updated */
Index *pPk; /* PK index if pTab is WITHOUT ROWID */
sqlite3_value **apDflt; /* Array of default values, if required */
- u8 keyinfoSpace[SZ_KEYINFO(0)]; /* Space to hold pKeyinfo[0] content */
+ u8 keyinfoSpace[SZ_KEYINFO_0]; /* Space to hold pKeyinfo[0] content */
};
/*