mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
Cbs and splay now pass size through as closure parameters, rather than messing with unsigned long.
Copied from Perforce Change: 177816 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
5225a4be56
commit
382d044e97
3 changed files with 13 additions and 17 deletions
|
|
@ -194,36 +194,32 @@ static Compare cbsSplayCompare(void *key, SplayNode node)
|
|||
/* cbsTestNode, cbsTestTree -- test for nodes larger than the S parameter */
|
||||
|
||||
static Bool cbsTestNode(SplayTree tree, SplayNode node,
|
||||
void *closureP, unsigned long closureS)
|
||||
void *closureP, Size size)
|
||||
{
|
||||
Size size;
|
||||
CBSBlock block;
|
||||
|
||||
AVERT(SplayTree, tree);
|
||||
AVERT(SplayNode, node);
|
||||
AVER(closureP == NULL);
|
||||
AVER(closureS > 0);
|
||||
AVER(size > 0);
|
||||
AVER(cbsOfSplayTree(tree)->fastFind);
|
||||
|
||||
size = (Size)closureS;
|
||||
block = cbsBlockOfSplayNode(node);
|
||||
|
||||
return CBSBlockSize(block) >= size;
|
||||
}
|
||||
|
||||
static Bool cbsTestTree(SplayTree tree, SplayNode node,
|
||||
void *closureP, unsigned long closureS)
|
||||
void *closureP, Size size)
|
||||
{
|
||||
Size size;
|
||||
CBSBlock block;
|
||||
|
||||
AVERT(SplayTree, tree);
|
||||
AVERT(SplayNode, node);
|
||||
AVER(closureP == NULL);
|
||||
AVER(closureS > 0);
|
||||
AVER(size > 0);
|
||||
AVER(cbsOfSplayTree(tree)->fastFind);
|
||||
|
||||
size = (Size)closureS;
|
||||
block = cbsBlockOfSplayNode(node);
|
||||
|
||||
return block->maxSize >= size;
|
||||
|
|
@ -1396,7 +1392,7 @@ Bool CBSFindFirst(Addr *baseReturn, Addr *limitReturn,
|
|||
|
||||
METER_ACC(cbs->splaySearch, cbs->splayTreeSize);
|
||||
found = SplayFindFirst(&node, splayTreeOfCBS(cbs), &cbsTestNode,
|
||||
&cbsTestTree, NULL, (unsigned long)size);
|
||||
&cbsTestTree, NULL, size);
|
||||
|
||||
if (found) {
|
||||
CBSBlock block;
|
||||
|
|
@ -1479,7 +1475,7 @@ Bool CBSFindLast(Addr *baseReturn, Addr *limitReturn,
|
|||
|
||||
METER_ACC(cbs->splaySearch, cbs->splayTreeSize);
|
||||
found = SplayFindLast(&node, splayTreeOfCBS(cbs), &cbsTestNode,
|
||||
&cbsTestTree, NULL, (unsigned long)size);
|
||||
&cbsTestTree, NULL, size);
|
||||
if (found) {
|
||||
CBSBlock block;
|
||||
|
||||
|
|
@ -1573,7 +1569,7 @@ Bool CBSFindLargest(Addr *baseReturn, Addr *limitReturn,
|
|||
size = cbsBlockOfSplayNode(root)->maxSize;
|
||||
METER_ACC(cbs->splaySearch, cbs->splayTreeSize);
|
||||
found = SplayFindFirst(&node, splayTreeOfCBS(cbs), &cbsTestNode,
|
||||
&cbsTestTree, NULL, (unsigned long)size);
|
||||
&cbsTestTree, NULL, size);
|
||||
AVER(found); /* maxSize is exact, so we will find it. */
|
||||
block = cbsBlockOfSplayNode(node);
|
||||
AVER(CBSBlockSize(block) >= size);
|
||||
|
|
|
|||
|
|
@ -883,7 +883,7 @@ static Compare SplayFindLastCompare(void *key, SplayNode node)
|
|||
Bool SplayFindFirst(SplayNode *nodeReturn, SplayTree tree,
|
||||
SplayTestNodeMethod testNode,
|
||||
SplayTestTreeMethod testTree,
|
||||
void *closureP, unsigned long closureS)
|
||||
void *closureP, Size closureS)
|
||||
{
|
||||
SplayNode node;
|
||||
SplayFindClosureStruct closureStruct;
|
||||
|
|
@ -919,7 +919,7 @@ Bool SplayFindFirst(SplayNode *nodeReturn, SplayTree tree,
|
|||
Bool SplayFindLast(SplayNode *nodeReturn, SplayTree tree,
|
||||
SplayTestNodeMethod testNode,
|
||||
SplayTestTreeMethod testTree,
|
||||
void *closureP, unsigned long closureS)
|
||||
void *closureP, Size closureS)
|
||||
{
|
||||
SplayNode node;
|
||||
SplayFindClosureStruct closureStruct;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ typedef struct SplayNodeStruct *SplayNode;
|
|||
typedef unsigned Compare;
|
||||
typedef Compare (*SplayCompareMethod)(void *key, SplayNode node);
|
||||
typedef Bool (*SplayTestNodeMethod)(SplayTree tree, SplayNode node,
|
||||
void *closureP, unsigned long closureS);
|
||||
void *closureP, Size closureS);
|
||||
typedef Bool (*SplayTestTreeMethod)(SplayTree tree, SplayNode node,
|
||||
void *closureP, unsigned long closureS);
|
||||
void *closureP, Size closureS);
|
||||
typedef void (*SplayUpdateNodeMethod)(SplayTree tree, SplayNode node,
|
||||
SplayNode leftChild,
|
||||
SplayNode rightChild);
|
||||
|
|
@ -67,11 +67,11 @@ extern SplayNode SplayTreeNext(SplayTree tree, SplayNode oldNode,
|
|||
extern Bool SplayFindFirst(SplayNode *nodeReturn, SplayTree tree,
|
||||
SplayTestNodeMethod testNode,
|
||||
SplayTestTreeMethod testTree,
|
||||
void *closureP, unsigned long closureS);
|
||||
void *closureP, Size closureS);
|
||||
extern Bool SplayFindLast(SplayNode *nodeReturn, SplayTree tree,
|
||||
SplayTestNodeMethod testNode,
|
||||
SplayTestTreeMethod testTree,
|
||||
void *closureP, unsigned long closureS);
|
||||
void *closureP, Size closureS);
|
||||
|
||||
extern void SplayNodeRefresh(SplayTree tree, SplayNode node, void *key);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue