simplified assertion

This commit is contained in:
2019-12-21 16:59:00 +00:00
parent c23d902ad0
commit 476a800572
26 changed files with 604 additions and 447 deletions

View File

@ -282,14 +282,14 @@ int hawk_htb_init (hawk_htb_t* htb, hawk_gem_t* gem, hawk_oow_t capa, int factor
{
/* The initial capacity should be greater than 0.
* Otherwise, it is adjusted to 1 in the release mode */
HAWK_ASSERT (hawk, capa > 0);
HAWK_ASSERT (capa > 0);
/* The load factor should be between 0 and 100 inclusive.
* In the release mode, a value out of the range is adjusted to 100 */
HAWK_ASSERT (hawk, factor >= 0 && factor <= 100);
HAWK_ASSERT (factor >= 0 && factor <= 100);
HAWK_ASSERT (hawk, kscale >= 0 && kscale <= HAWK_TYPE_MAX(hawk_uint8_t));
HAWK_ASSERT (hawk, vscale >= 0 && vscale <= HAWK_TYPE_MAX(hawk_uint8_t));
HAWK_ASSERT (kscale >= 0 && kscale <= HAWK_TYPE_MAX(hawk_uint8_t));
HAWK_ASSERT (vscale >= 0 && vscale <= HAWK_TYPE_MAX(hawk_uint8_t));
/* some initial adjustment */
if (capa <= 0) capa = 1;
@ -331,7 +331,7 @@ const style_t* hawk_htb_getstyle (const hawk_htb_t* htb)
void hawk_htb_setstyle (hawk_htb_t* htb, const style_t* style)
{
HAWK_ASSERT (htb->gem, style != HAWK_NULL);
HAWK_ASSERT (style != HAWK_NULL);
htb->style = style;
}
@ -500,7 +500,7 @@ static HAWK_INLINE pair_t* insert (hawk_htb_t* htb, void* kptr, hawk_oow_t klen,
}
}
HAWK_ASSERT (htb->gem, pair == HAWK_NULL);
HAWK_ASSERT (pair == HAWK_NULL);
pair = hawk_htb_allocpair (htb, kptr, klen, vptr, vlen);
if (pair == HAWK_NULL) return HAWK_NULL; /* error */
@ -581,7 +581,7 @@ pair_t* hawk_htb_cbsert (hawk_htb_t* htb, void* kptr, hawk_oow_t klen, cbserter_
}
}
HAWK_ASSERT (htb->gem, pair == HAWK_NULL);
HAWK_ASSERT (pair == HAWK_NULL);
pair = cbserter(htb, HAWK_NULL, kptr, klen, ctx);
if (pair == HAWK_NULL) return HAWK_NULL; /* error */