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

Improve control over checking:

1. Where Type is a pointer type with a signature, replace CHECKL(TypeCheck(val)) with CHECKD(Type, val).
2. Where Type is a pointer type with no signature, replace CHECKL(TypeCheck(val)) with CHECKD_NOSIG(Type, val).
3. Where Type is a pointer type with a signature, but the structure is not visible at point of checking, replace CHECKL(TypeCheck(val)) with CHECKD_NOSIG(Type, val). Reference <design/check/#.hidden-type>
4. Make BTCheck extern and use it where possible.
5. Replace AVER(TypeCheck(val)) with AVERT(Type, val).

Copied from Perforce
 Change: 185263
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-04-06 22:51:05 +01:00
parent f970e9d82c
commit bcea6812fc
46 changed files with 287 additions and 278 deletions

View file

@ -37,7 +37,7 @@ SRCID(pool, "$Id$");
Bool PoolClassCheck(PoolClass class)
{
CHECKL(ProtocolClassCheck(&class->protocol));
CHECKD(ProtocolClass, &class->protocol);
CHECKL(class->name != NULL); /* Should be <=6 char C identifier */
CHECKL(class->size >= sizeof(PoolStruct));
/* Offset of generic Pool within class-specific instance cannot be */
@ -87,10 +87,10 @@ Bool PoolCheck(Pool pool)
CHECKL(pool->serial < ArenaGlobals(pool->arena)->poolSerial);
CHECKD(PoolClass, pool->class);
CHECKU(Arena, pool->arena);
CHECKL(RingCheck(&pool->arenaRing));
CHECKL(RingCheck(&pool->bufferRing));
CHECKD_NOSIG(Ring, &pool->arenaRing);
CHECKD_NOSIG(Ring, &pool->bufferRing);
/* Cannot check pool->bufferSerial */
CHECKL(RingCheck(&pool->segRing));
CHECKD_NOSIG(Ring, &pool->segRing);
CHECKL(AlignCheck(pool->alignment));
/* normally pool->format iff PoolHasAttr(pool, AttrFMT), but during
* pool initialization pool->format may not yet be set. */
@ -286,7 +286,7 @@ Res PoolAlloc(Addr *pReturn, Pool pool, Size size,
AVERT(Pool, pool);
AVER(PoolHasAttr(pool, AttrALLOC));
AVER(size > 0);
AVER(BoolCheck(withReservoirPermit));
AVERT(Bool, withReservoirPermit);
res = (*pool->class->alloc)(pReturn, pool, size, withReservoirPermit);
if (res != ResOK)