diff options
Diffstat (limited to 'ext/sqlite/libsqlite/src/btree_rb.c')
-rw-r--r-- | ext/sqlite/libsqlite/src/btree_rb.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/ext/sqlite/libsqlite/src/btree_rb.c b/ext/sqlite/libsqlite/src/btree_rb.c index 49009be830..d932ab4a97 100644 --- a/ext/sqlite/libsqlite/src/btree_rb.c +++ b/ext/sqlite/libsqlite/src/btree_rb.c @@ -259,17 +259,16 @@ static void rightRotate(BtRbTree *pTree, BtRbNode *pX) * concatenation of orig and val is returned. The original orig is deleted * (using sqliteFree()). */ -static char *append_val(char * orig, char const * val) -{ +static char *append_val(char * orig, char const * val){ + char *z; if( !orig ){ - return sqliteStrDup( val ); + z = sqliteStrDup( val ); } else{ - char * ret = 0; - sqliteSetString(&ret, orig, val, (char*)0); + z = 0; + sqliteSetString(&z, orig, val, (char*)0); sqliteFree( orig ); - return ret; } - assert(0); + return z; } /* @@ -723,13 +722,13 @@ static int memRbtreeCursor( pCur = *ppCur = sqliteMalloc(sizeof(RbtCursor)); if( sqlite_malloc_failed ) return SQLITE_NOMEM; pCur->pTree = sqliteHashFind(&tree->tblHash, 0, iTable); + assert( pCur->pTree ); pCur->pRbtree = tree; pCur->iTree = iTable; pCur->pOps = &sqliteRbtreeCursorOps; pCur->wrFlag = wrFlag; pCur->pShared = pCur->pTree->pCursors; pCur->pTree->pCursors = pCur; - assert( (*ppCur)->pTree ); return SQLITE_OK; @@ -1178,12 +1177,11 @@ static int memRbtreeKey(RbtCursor* pCur, int offset, int amt, char *zBuf) if( !pCur->pNode ) return 0; if( !pCur->pNode->pKey || ((amt + offset) <= pCur->pNode->nKey) ){ memcpy(zBuf, ((char*)pCur->pNode->pKey)+offset, amt); - return amt; }else{ memcpy(zBuf, ((char*)pCur->pNode->pKey)+offset, pCur->pNode->nKey-offset); - return pCur->pNode->nKey-offset; + amt = pCur->pNode->nKey-offset; } - assert(0); + return amt; } static int memRbtreeDataSize(RbtCursor* pCur, int *pSize) @@ -1201,12 +1199,11 @@ static int memRbtreeData(RbtCursor *pCur, int offset, int amt, char *zBuf) if( !pCur->pNode ) return 0; if( (amt + offset) <= pCur->pNode->nData ){ memcpy(zBuf, ((char*)pCur->pNode->pData)+offset, amt); - return amt; }else{ memcpy(zBuf, ((char*)pCur->pNode->pData)+offset ,pCur->pNode->nData-offset); - return pCur->pNode->nData-offset; + amt = pCur->pNode->nData-offset; } - assert(0); + return amt; } static int memRbtreeCloseCursor(RbtCursor* pCur) @@ -1421,13 +1418,12 @@ static int memRbtreeCursorDump(RbtCursor* pCur, int* aRes) assert(!"Cannot call sqliteRbtreeCursorDump"); return SQLITE_OK; } +#endif static struct Pager *memRbtreePager(Rbtree* tree) { - assert(!"Cannot call sqliteRbtreePager"); - return SQLITE_OK; + return 0; } -#endif /* ** Return the full pathname of the underlying database file. @@ -1463,10 +1459,9 @@ static BtOps sqliteRbtreeOps = { (char*(*)(Btree*,int*,int)) memRbtreeIntegrityCheck, (const char*(*)(Btree*)) memRbtreeGetFilename, (int(*)(Btree*,Btree*)) memRbtreeCopyFile, - + (struct Pager*(*)(Btree*)) memRbtreePager, #ifdef SQLITE_TEST (int(*)(Btree*,int,int)) memRbtreePageDump, - (struct Pager*(*)(Btree*)) memRbtreePager #endif }; |