Three times faster sqlite3SrcListAppend() in the common case by avoiding the
call to sqlite3SrcListEnlarge() for the first allocation. FossilOrigin-Name: 0ea2762f1d8f6a93ae2ee3b7b835927a474c6f66
This commit is contained in:
+5
-2
@@ -3736,9 +3736,12 @@ SrcList *sqlite3SrcListAppend(
|
||||
pList = sqlite3DbMallocRawNN(db, sizeof(SrcList) );
|
||||
if( pList==0 ) return 0;
|
||||
pList->nAlloc = 1;
|
||||
pList->nSrc = 0;
|
||||
pList->nSrc = 1;
|
||||
memset(&pList->a[0], 0, sizeof(pList->a[0]));
|
||||
pList->a[0].iCursor = -1;
|
||||
}else{
|
||||
pList = sqlite3SrcListEnlarge(db, pList, 1, pList->nSrc);
|
||||
}
|
||||
pList = sqlite3SrcListEnlarge(db, pList, 1, pList->nSrc);
|
||||
if( db->mallocFailed ){
|
||||
sqlite3SrcListDelete(db, pList);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user