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

Add assert() statements to verify that u16 pointers associated with

the enhancement in [897f56a158] are always 2-byte aligned.

FossilOrigin-Name: 98ccfa930e8e5f10808a518e3e22e85e8a8a65c2
This commit is contained in:
drh
2011-06-06 13:38:11 +00:00
parent afb9817f8c
commit 2ce71b4e7a
3 changed files with 9 additions and 7 deletions

View File

@@ -5421,6 +5421,7 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
return;
}
endPtr = &data[pPage->cellOffset + 2*pPage->nCell - 2];
assert( (SQLITE_PTR_TO_INT(ptr)&1)==0 ); /* ptr is always 2-byte aligned */
while( ptr<endPtr ){
*(u16*)ptr = *(u16*)&ptr[2];
ptr += 2;
@@ -5516,6 +5517,7 @@ static void insertCell(
}
ptr = &data[end];
endPtr = &data[ins];
assert( (SQLITE_PTR_TO_INT(ptr)&1)==0 ); /* ptr is always 2-byte aligned */
while( ptr>endPtr ){
*(u16*)ptr = *(u16*)&ptr[-2];
ptr -= 2;