1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Additional code to make sure and to assert that memory allocations have

8-byte alignment.  Ticket #3777. (CVS 6450)

FossilOrigin-Name: 208382e032134d9c78fe1cfcb98ce9defb4e3e26
This commit is contained in:
drh
2009-04-05 12:22:08 +00:00
parent 3c71364643
commit ea598cbd8d
8 changed files with 50 additions and 31 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.589 2009/04/02 20:16:59 drh Exp $
** $Id: btree.c,v 1.590 2009/04/05 12:22:09 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -5357,13 +5357,13 @@ static int balance_nonroot(BtCursor *pCur){
}
szCell = (u16*)&apCell[nMaxCells];
aCopy[0] = (u8*)&szCell[nMaxCells];
assert( ((aCopy[0] - (u8*)0) & 7)==0 ); /* 8-byte alignment required */
assert( EIGHT_BYTE_ALIGNMENT(aCopy[0]) );
for(i=1; i<NB; i++){
aCopy[i] = &aCopy[i-1][pBt->pageSize+ROUND8(sizeof(MemPage))];
assert( ((aCopy[i] - (u8*)0) & 7)==0 ); /* 8-byte alignment required */
}
aSpace1 = &aCopy[NB-1][pBt->pageSize+ROUND8(sizeof(MemPage))];
assert( ((aSpace1 - (u8*)0) & 7)==0 ); /* 8-byte alignment required */
assert( EIGHT_BYTE_ALIGNMENT(aSpace1) );
if( ISAUTOVACUUM ){
aFrom = &aSpace1[pBt->pageSize];
}