aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2025-02-10 11:16:37 +0000
committerdrh <>2025-02-10 11:16:37 +0000
commita0d35d44e4382e761943b263b9183234d44f1f0b (patch)
tree29508a07e07e29ab4ff9f190ee829d822630e47c /src
parent93df8109fc188b35968fa3a4d51400866399fd7c (diff)
downloadsqlite-a0d35d44e4382e761943b263b9183234d44f1f0b.tar.gz
sqlite-a0d35d44e4382e761943b263b9183234d44f1f0b.zip
Convert some expensive NEVER() and ASSERT() macros into assert()s.
FossilOrigin-Name: 4aad891802d9d87f1ff3cbbf4bc70fa242c6782088189a2bd5d6f8863f552d29
Diffstat (limited to 'src')
-rw-r--r--src/json.c9
-rw-r--r--src/util.c6
-rw-r--r--src/vdbemem.c2
3 files changed, 9 insertions, 8 deletions
diff --git a/src/json.c b/src/json.c
index 2517f6c31..47a9c875e 100644
--- a/src/json.c
+++ b/src/json.c
@@ -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;
diff --git a/src/util.c b/src/util.c
index ecce460e0..703ef0a23 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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 );
+ }
}
/*
diff --git a/src/vdbemem.c b/src/vdbemem.c
index 38ba5abe8..61298d10f 100644
--- a/src/vdbemem.c
+++ b/src/vdbemem.c
@@ -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)