1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 08:43:40 -07:00

Turning pool init methods the right way in, so that they each call the next method up the class hierarchy.

Copied from Perforce
 Change: 190858
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Brooksby 2016-04-10 17:49:08 +01:00
parent 111136891e
commit 3dd201bf47
26 changed files with 347 additions and 189 deletions

View file

@ -23,6 +23,8 @@
SRCID(poolsnc, "$Id$");
DECLARE_CLASS(Pool, SNCPool);
/* SNCStruct -- structure for an SNC pool
*
@ -35,7 +37,7 @@ typedef struct SNCStruct {
PoolStruct poolStruct;
Seg freeSegs;
Sig sig;
} SNCStruct, *SNC;
} SNCStruct, *SNC, *SNCPool;
#define PoolSNC(pool) PARENT(SNCStruct, poolStruct, (pool))
#define SNCPool(snc) (&(snc)->poolStruct)
@ -364,16 +366,23 @@ static void SNCVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs)
/* SNCInit -- initialize an SNC pool */
static Res SNCInit(Pool pool, ArgList args)
static Res SNCInit(Pool pool, Arena arena, PoolClass class, ArgList args)
{
SNC snc;
Format format;
ArgStruct arg;
Res res;
/* weak check, as half-way through initialization */
AVER(pool != NULL);
AVERT(Arena, arena);
AVERT(ArgList, args);
UNUSED(class); /* used for debug pools only */
snc = PoolSNC(pool);
res = PoolAbsInit(pool, arena, class, args);
if (res != ResOK)
return res;
SetClassOfPool(pool, CLASS(SNCPool));
snc = MustBeA(SNCPool, pool);
ArgRequire(&arg, args, MPS_KEY_FORMAT);
format = arg.val.format;
@ -407,6 +416,8 @@ static void SNCFinish(Pool pool)
AVERT(Seg, seg);
SegFree(seg);
}
PoolAbsFinish(pool);
}
@ -733,6 +744,7 @@ ATTRIBUTE_UNUSED
static Bool SNCCheck(SNC snc)
{
CHECKS(SNC, snc);
CHECKC(SNCPool, snc);
CHECKD(Pool, SNCPool(snc));
CHECKL(ClassOfPool(SNCPool(snc)) == CLASS(SNCPool));
if (snc->freeSegs != NULL) {