This commit is contained in:
@@ -22,18 +22,16 @@ PH7_PRIVATE sxi32 SySetPut(SySet *pSet, const void *pItem) {
|
||||
unsigned char *zbase;
|
||||
if(pSet->nUsed >= pSet->nSize) {
|
||||
void *pNew;
|
||||
sxu32 nSize = pSet->nSize > 0 ? pSet->nSize * 2 : 8;
|
||||
if(pSet->pAllocator == 0) {
|
||||
return SXERR_LOCKED;
|
||||
}
|
||||
if(pSet->nSize <= 0) {
|
||||
pSet->nSize = 4;
|
||||
}
|
||||
pNew = SyMemBackendRealloc(pSet->pAllocator, pSet->pBase, pSet->eSize * pSet->nSize * 2);
|
||||
pNew = SyMemBackendRealloc(pSet->pAllocator, pSet->pBase, pSet->eSize * nSize);
|
||||
if(pNew == 0) {
|
||||
return SXERR_MEM;
|
||||
}
|
||||
pSet->pBase = pNew;
|
||||
pSet->nSize <<= 1;
|
||||
pSet->nSize = nSize;
|
||||
}
|
||||
zbase = (unsigned char *)pSet->pBase;
|
||||
SX_MACRO_FAST_MEMCPY(pItem, &zbase[pSet->nUsed * pSet->eSize], pSet->eSize);
|
||||
@@ -384,4 +382,4 @@ PH7_PRIVATE SyHashEntry *SyHashLastEntry(SyHash *pHash) {
|
||||
}
|
||||
/* Last inserted entry */
|
||||
return (SyHashEntry *)pHash->pList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user