@@ -730,7 +730,7 @@ struct unqlite_page
730730{
731731 unsigned char *zData; /* Content of this page */
732732 void *pUserData; /* Extra content */
733- pgno pgno; /* Page number for this page */
733+ pgno iPage; /* Page number for this page */
734734};
735735/*
736736 * UnQLite handle to the underlying Key/Value Storage Engine (See below).
@@ -49599,7 +49599,7 @@ static int lhash_read_header(lhash_kv_engine *pEngine,unqlite_page *pHeader)
4959949599 /* Initialiaze the bucket map */
4960049600 pMap = &pEngine->sPageMap;
4960149601 /* Fill in the structure */
49602- pMap->iNum = pHeader->pgno ;
49602+ pMap->iNum = pHeader->iPage ;
4960349603 /* Next page in the bucket map */
4960449604 SyBigEndianUnpack64(zRaw,&pMap->iNext);
4960549605 zRaw += 8;
@@ -49748,20 +49748,20 @@ static int lhMapWriteRecord(lhash_kv_engine *pEngine,pgno iLogic,pgno iReal)
4974849748 }
4974949749 /* Reflect the change */
4975049750 pMap->iNext = 0;
49751- pMap->iNum = pPage->pgno ;
49751+ pMap->iNum = pPage->iPage ;
4975249752 pMap->nRec = 0;
4975349753 pMap->iPtr = 8/* Next page number */+4/* Total records in the map*/;
4975449754 /* Link this page */
4975549755 rc = pEngine->pIo->xWrite(pOld);
4975649756 if( rc != UNQLITE_OK ){
4975749757 return rc;
4975849758 }
49759- if( pOld->pgno == pEngine->pHeader->pgno ){
49759+ if( pOld->iPage == pEngine->pHeader->iPage ){
4976049760 /* First page (Hash header) */
49761- SyBigEndianPack64(&pOld->zData[4/*magic*/+4/*hash*/+8/* Free page */+8/*current split bucket*/+8/*Maximum split bucket*/],pPage->pgno );
49761+ SyBigEndianPack64(&pOld->zData[4/*magic*/+4/*hash*/+8/* Free page */+8/*current split bucket*/+8/*Maximum split bucket*/],pPage->iPage );
4976249762 }else{
4976349763 /* Link the new page */
49764- SyBigEndianPack64(pOld->zData,pPage->pgno );
49764+ SyBigEndianPack64(pOld->zData,pPage->iPage );
4976549765 /* Unref */
4976649766 pEngine->pIo->xPageUnref(pOld);
4976749767 }
@@ -49794,7 +49794,7 @@ static int lhMapWriteRecord(lhash_kv_engine *pEngine,pgno iLogic,pgno iReal)
4979449794 if( rc == UNQLITE_OK ){
4979549795 /* Total number of records */
4979649796 pMap->nRec++;
49797- if( pPage->pgno == pEngine->pHeader->pgno ){
49797+ if( pPage->iPage == pEngine->pHeader->iPage ){
4979849798 /* Page one: Always writable */
4979949799 SyBigEndianPack32(
4980049800 &pPage->zData[4/*magic*/+4/*hash*/+8/* Free page */+8/*current split bucket*/+8/*Maximum split bucket*/+8/*Next map page*/],
@@ -49832,7 +49832,7 @@ static int lhPageDefragment(lhpage *pPage)
4983249832 /* No more cells */
4983349833 break;
4983449834 }
49835- if( pCell->pPage->pRaw->pgno == pPage->pRaw->pgno ){
49835+ if( pCell->pPage->pRaw->iPage == pPage->pRaw->iPage ){
4983649836 /* Cell payload if locally stored */
4983749837 zPayload = 0;
4983849838 if( pCell->iOvfl == 0 ){
@@ -50061,7 +50061,7 @@ static int lhCellWriteOvflPayload(lhcell *pCell,const void *pKey,sxu32 nKeylen,.
5006150061 }
5006250062 pFirst = pOvfl;
5006350063 /* Link */
50064- pCell->iOvfl = pOvfl->pgno ;
50064+ pCell->iOvfl = pOvfl->iPage ;
5006550065 /* Update the cell header */
5006650066 SyBigEndianPack64(&pPage->pRaw->zData[pCell->iStart + 4/*Hash*/ + 4/*Key*/ + 8/*Data*/ + 2 /*Next cell*/],pCell->iOvfl);
5006750067 /* Start the write process */
@@ -50087,7 +50087,7 @@ static int lhCellWriteOvflPayload(lhcell *pCell,const void *pKey,sxu32 nKeylen,.
5008750087 return rc;
5008850088 }
5008950089 /* Link */
50090- SyBigEndianPack64(pOvfl->zData,pNew->pgno );
50090+ SyBigEndianPack64(pOvfl->zData,pNew->iPage );
5009150091 pEngine->pIo->xPageUnref(pOvfl);
5009250092 SyBigEndianPack64(pNew->zData,0); /* Next overflow page on the chain */
5009350093 pOvfl = pNew;
@@ -50106,7 +50106,7 @@ static int lhCellWriteOvflPayload(lhcell *pCell,const void *pKey,sxu32 nKeylen,.
5010650106 }
5010750107 rc = UNQLITE_OK;
5010850108 va_start(ap,nKeylen);
50109- pCell->iDataPage = pNew->pgno ;
50109+ pCell->iDataPage = pNew->iPage ;
5011050110 pCell->iDataOfft = (sxu16)(zRaw-pNew->zData);
5011150111 /* Write the data page and its offset */
5011250112 SyBigEndianPack64(&pFirst->zData[8/*Next ovfl*/],pCell->iDataPage);
@@ -50142,7 +50142,7 @@ static int lhCellWriteOvflPayload(lhcell *pCell,const void *pKey,sxu32 nKeylen,.
5014250142 return rc;
5014350143 }
5014450144 /* Link */
50145- SyBigEndianPack64(pOvfl->zData,pNew->pgno );
50145+ SyBigEndianPack64(pOvfl->zData,pNew->iPage );
5014650146 pEngine->pIo->xPageUnref(pOvfl);
5014750147 SyBigEndianPack64(pNew->zData,0); /* Next overflow page on the chain */
5014850148 pOvfl = pNew;
@@ -50181,7 +50181,7 @@ static int lhRestorePage(lhash_kv_engine *pEngine,unqlite_page *pPage)
5018150181 }
5018250182 /* Link to the list of free page */
5018350183 SyBigEndianPack64(pPage->zData,pEngine->nFreeList);
50184- pEngine->nFreeList = pPage->pgno ;
50184+ pEngine->nFreeList = pPage->iPage ;
5018550185 SyBigEndianPack64(&pEngine->pHeader->zData[4/*Magic*/+4/*Hash*/],pEngine->nFreeList);
5018650186 /* All done */
5018750187 return UNQLITE_OK;
@@ -50451,7 +50451,7 @@ static int lhRecordOverwrite(
5045150451 return rc;
5045250452 }
5045350453 /* Link */
50454- SyBigEndianPack64(pOvfl->zData,pNew->pgno );
50454+ SyBigEndianPack64(pOvfl->zData,pNew->iPage );
5045550455 pEngine->pIo->xPageUnref(pOvfl);
5045650456 SyBigEndianPack64(pNew->zData,0); /* Next overflow page on the chain */
5045750457 pOvfl = pNew;
@@ -50612,7 +50612,7 @@ static int lhRecordAppend(
5061250612 return rc;
5061350613 }
5061450614 /* Link */
50615- SyBigEndianPack64(pOvfl->zData,pNew->pgno );
50615+ SyBigEndianPack64(pOvfl->zData,pNew->iPage );
5061650616 pEngine->pIo->xPageUnref(pOvfl);
5061750617 SyBigEndianPack64(pNew->zData,0); /* Next overflow page on the chain */
5061850618 pOvfl = pNew;
@@ -50823,8 +50823,8 @@ static int lhFindSlavePage(lhpage *pPage,sxu64 nAmount,sxu16 *pOfft,lhpage **ppS
5082350823 goto fail;
5082450824 }
5082550825 /* Reflect in the page header */
50826- SyBigEndianPack64(&pSlave->pRaw->zData[2/*Cell offset*/+2/*Free block offset*/],pRaw->pgno );
50827- pSlave->sHdr.iSlave = pRaw->pgno ;
50826+ SyBigEndianPack64(&pSlave->pRaw->zData[2/*Cell offset*/+2/*Free block offset*/],pRaw->iPage );
50827+ pSlave->sHdr.iSlave = pRaw->iPage ;
5082850828 /* All done */
5082950829 *ppSlave = pNew;
5083050830 return UNQLITE_OK;
@@ -51003,12 +51003,12 @@ static int lhSplit(lhpage *pTarget,int *pRetry)
5100351003 /* Install and write the logical map record */
5100451004 rc = lhMapWriteRecord(pEngine,
5100551005 pEngine->split_bucket + pEngine->max_split_bucket,
51006- pRaw->pgno
51006+ pRaw->iPage
5100751007 );
5100851008 if( rc != UNQLITE_OK ){
5100951009 goto fail;
5101051010 }
51011- if( pTarget->pRaw->pgno == pOld->pRaw->pgno ){
51011+ if( pTarget->pRaw->iPage == pOld->pRaw->iPage ){
5101251012 *pRetry = 1;
5101351013 }
5101451014 /* Perform the split */
@@ -51131,7 +51131,7 @@ static int lh_record_insert(
5113151131 rc = lhStoreCell(pPage,pKey,nKeyLen,pData,nDataLen,nHash,1);
5113251132 if( rc == UNQLITE_OK ){
5113351133 /* Install and write the logical map record */
51134- rc = lhMapWriteRecord(pEngine,iBucket,pRaw->pgno );
51134+ rc = lhMapWriteRecord(pEngine,iBucket,pRaw->iPage );
5113551135 }
5113651136 pEngine->pIo->xPageUnref(pRaw);
5113751137 return rc;
@@ -51219,7 +51219,7 @@ static int lhash_write_header(lhash_kv_engine *pEngine,unqlite_page *pHeader)
5121951219 /* Initialize the bucket map */
5122051220 pMap = &pEngine->sPageMap;
5122151221 /* Fill in the structure */
51222- pMap->iNum = pHeader->pgno ;
51222+ pMap->iNum = pHeader->iPage ;
5122351223 /* Next page in the bucket map */
5122451224 SyBigEndianPack64(zRaw,0);
5122551225 zRaw += 8;
@@ -55432,6 +55432,9 @@ UNQLITE_PRIVATE const unqlite_vfs * unqliteExportBuiltinVfs(void)
5543255432**
5543355433**
5543455434*/
55435+ #ifndef NULL
55436+ #define NULL 0
55437+ #endif
5543555438#define PAGER_OPEN 0
5543655439#define PAGER_READER 1
5543755440#define PAGER_WRITER_LOCKED 2
0 commit comments