diff options
author | drh <> | 2025-05-30 15:43:04 +0000 |
---|---|---|
committer | drh <> | 2025-05-30 15:43:04 +0000 |
commit | 8ae57fab64aa1e16596763b9d9435aa1f7e9933d (patch) | |
tree | 08f48e7b32ea63b4a1884af32452e5be6c222e2f /src/sqliteInt.h | |
parent | b65326f51a2c8c9fcb5331cde36d55aa7d209a27 (diff) | |
download | sqlite-8ae57fab64aa1e16596763b9d9435aa1f7e9933d.tar.gz sqlite-8ae57fab64aa1e16596763b9d9435aa1f7e9933d.zip |
Use a more robust backup definition for offsetof().
FossilOrigin-Name: 22441955e03df07903b98832a60c05c53721cd67c667f6c83d5e97fcc62735ee
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r-- | src/sqliteInt.h | 9 |
1 files changed, 8 insertions, 1 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. */ |