1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Convert some expensive NEVER() and ASSERT() macros into assert()s.

FossilOrigin-Name: 4aad891802d9d87f1ff3cbbf4bc70fa242c6782088189a2bd5d6f8863f552d29
This commit is contained in:
drh
2025-02-10 11:16:37 +00:00
parent 93df8109fc
commit a0d35d44e4
5 changed files with 18 additions and 17 deletions

View File

@ -2054,10 +2054,7 @@ static u32 jsonbPayloadSize(const JsonParse *pParse, u32 i, u32 *pSz){
u8 x;
u32 sz;
u32 n;
if( NEVER(i>pParse->nBlob) ){
*pSz = 0;
return 0;
}
assert( i<=pParse->nBlob );
x = pParse->aBlob[i]>>4;
if( x<=11 ){
sz = x;
@ -2101,8 +2098,8 @@ static u32 jsonbPayloadSize(const JsonParse *pParse, u32 i, u32 *pSz){
if( (i64)i+sz+n > pParse->nBlob
&& (i64)i+sz+n > pParse->nBlob-pParse->delta
){
sz = 0;
n = 0;
*pSz = 0;
return 0;
}
*pSz = sz;
return n;

View File

@ -1130,7 +1130,11 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
}
p->z = &p->zBuf[i+1];
assert( i+p->n < sizeof(p->zBuf) );
while( ALWAYS(p->n>0) && p->z[p->n-1]=='0' ){ p->n--; }
assert( p->n>0 );
while( p->z[p->n-1]=='0' ){
p->n--;
assert( p->n>0 );
}
}
/*

View File

@ -327,7 +327,7 @@ void sqlite3VdbeMemZeroTerminateIfAble(Mem *pMem){
return;
}
if( pMem->enc!=SQLITE_UTF8 ) return;
if( NEVER(pMem->z==0) ) return;
assert( pMem->z!=0 );
if( pMem->flags & MEM_Dyn ){
if( pMem->xDel==sqlite3_free
&& sqlite3_msize(pMem->z) >= (u64)(pMem->n+1)