diff options
author | drh <drh@noemail.net> | 2018-10-31 20:52:00 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-10-31 20:52:00 +0000 |
commit | 7301e774025bc765e12a0f1a450d4aaddc3ea53f (patch) | |
tree | b5385c3b3a124d66ecbe3f92258f0b1d9ca9beb7 /src | |
parent | a60c63013ef1d02e7d63ee9b3951fec4555882da (diff) | |
download | sqlite-7301e774025bc765e12a0f1a450d4aaddc3ea53f.tar.gz sqlite-7301e774025bc765e12a0f1a450d4aaddc3ea53f.zip |
Deploy the sqlite3Strlen30NN() function (argument guaranteed to be non-NULL) for
a small performance improvement.
FossilOrigin-Name: 4a6ad5190b62020d97a7de02c801544f20b7b98145ceff14af1f2834d3057f9c
Diffstat (limited to 'src')
-rw-r--r-- | src/expr.c | 2 | ||||
-rw-r--r-- | src/insert.c | 3 | ||||
-rw-r--r-- | src/sqliteInt.h | 1 | ||||
-rw-r--r-- | src/vdbemem.c | 3 |
4 files changed, 6 insertions, 3 deletions
diff --git a/src/expr.c b/src/expr.c index 9c0ce1f87..d4eb9de62 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1167,7 +1167,7 @@ static int dupedExprStructSize(Expr *p, int flags){ static int dupedExprNodeSize(Expr *p, int flags){ int nByte = dupedExprStructSize(p, flags) & 0xfff; if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ - nByte += sqlite3Strlen30(p->u.zToken)+1; + nByte += sqlite3Strlen30NN(p->u.zToken)+1; } return ROUND8(nByte); } diff --git a/src/insert.c b/src/insert.c index d110ab763..7a9413901 100644 --- a/src/insert.c +++ b/src/insert.c @@ -146,7 +146,8 @@ void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){ }while( i>=0 && zColAff[i]==SQLITE_AFF_BLOB ); pTab->zColAff = zColAff; } - i = sqlite3Strlen30(zColAff); + assert( zColAff!=0 ); + i = sqlite3Strlen30NN(zColAff); if( i ){ if( iReg ){ sqlite3VdbeAddOp4(v, OP_Affinity, iReg, i, 0, zColAff, i); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 0d6761f47..20db52de3 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3665,6 +3665,7 @@ int sqlite3IsIdChar(u8); */ int sqlite3StrICmp(const char*,const char*); int sqlite3Strlen30(const char*); +#define sqlite3Strlen30NN(C) (strlen(C)&0x3fffffff) char *sqlite3ColumnType(Column*,char*); #define sqlite3StrNICmp sqlite3_strnicmp diff --git a/src/vdbemem.c b/src/vdbemem.c index d204dc8d2..db8feddfb 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -377,7 +377,8 @@ int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){ assert( fg & MEM_Real ); sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->u.r); } - pMem->n = sqlite3Strlen30(pMem->z); + assert( pMem->z!=0 ); + pMem->n = sqlite3Strlen30NN(pMem->z); pMem->enc = SQLITE_UTF8; pMem->flags |= MEM_Str|MEM_Term; if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real); |