1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Add assert() statements to demonstrate that memory allocations are always

aligned to an 8-byte boundary (unless SQLITE_4_BYTE_ALIGNED_MALLOC is defined).

FossilOrigin-Name: 305cc4e6c1164b1ede0c3177e3c0f9b8644df0f6
This commit is contained in:
drh
2010-09-11 15:54:53 +00:00
parent d9e430e953
commit 1567acf96a
3 changed files with 10 additions and 8 deletions

View File

@@ -307,6 +307,7 @@ void *sqlite3Malloc(int n){
}else{
p = sqlite3GlobalConfig.m.xMalloc(n);
}
assert( EIGHT_BYTE_ALIGNMENT(p) ); /* IMP: R-36023-12588 */
return p;
}
@@ -544,6 +545,7 @@ void *sqlite3Realloc(void *pOld, int nBytes){
}else{
pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
}
assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-36023-12588 */
return pNew;
}