*/
XBT_INLINE void xbt_swag_insert_at_head(void *obj, xbt_swag_t swag)
{
+ xbt_assert(!xbt_swag_belongs(obj, swag) || swag->tail,
+ "This object belongs to an empty swag! Did you correctly initialize the object's hookup?");
+
if (!swag->head) {
xbt_assert(!(swag->tail), "Inconsistent swag.");
swag->head = obj;
*/
XBT_INLINE void xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag)
{
- if (xbt_swag_belongs(obj, swag)) {
- return;
- }
+ xbt_assert(!xbt_swag_belongs(obj, swag) || swag->tail,
+ "This object belongs to an empty swag! Did you correctly initialize the object's hookup?");
- if (!swag->tail) {
- xbt_assert(!(swag->head), "Inconsistent swag.");
+ if (!swag->head) {
+ xbt_assert(!(swag->tail), "Inconsistent swag.");
swag->head = obj;
swag->tail = obj;
swag->count++;