-/* Copyright (c) 2004-2017. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2004-2023. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This type should be added to a type that is to be used in such a swag */
#include "swag.h"
-#include "xbt/asserts.h"
+#include "mmprivate.h" // mmalloc_assert
typedef s_xbt_swag_hookup_t *xbt_swag_hookup_t;
typedef struct xbt_swag* xbt_swag_t;
static inline void *xbt_swag_getFirst(const_xbt_swag_t swag)
{
- return (swag->head);
+ return swag->head;
}
/*
- * \brief Offset computation
- * \arg var a variable of type <tt>struct</tt> something
- * \arg field a field of <tt>struct</tt> something
- * \return the offset of \a field in <tt>struct</tt> something.
+ * @brief Offset computation
+ * @arg var a variable of type <tt>struct</tt> something
+ * @arg field a field of <tt>struct</tt> something
+ * @return the offset of @a field in <tt>struct</tt> something.
* @hideinitializer
*
* It is very similar to offsetof except that is done at runtime and that you have to declare a variable. Why defining
/* @} */
/* Creates a new swag.
- * \param swag the swag to initialize
- * \param offset where the hookup is located in the structure
- * \see xbt_swag_offset
+ * @param swag the swag to initialize
+ * @param offset where the hookup is located in the structure
+ * @see xbt_swag_offset
*
* Usage : xbt_swag_init(swag,&obj.setA-&obj);
*/
}
/*
- * \param obj the objet to insert in the swag
- * \param swag a swag
+ * @param obj the object to insert in the swag
+ * @param swag a swag
*
- * insert (at the tail... you probably had a very good reason to do that, I hope you know what you're doing) \a obj in
- * \a swag
+ * insert (at the tail... you probably had a very good reason to do that, I hope you know what you're doing) @a obj in
+ * @a swag
*/
static inline void xbt_swag_insert(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?");
+
+ mmalloc_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.");
+ mmalloc_assert(!(swag->tail), "Inconsistent swag.");
swag->head = obj;
swag->tail = obj;
swag->count++;
}
/*
- * \param obj the objet to remove from the swag
- * \param swag a swag
- * \return \a obj if it was in the \a swag and NULL otherwise
+ * @param obj the object to remove from the swag
+ * @param swag a swag
+ * @return @a obj if it was in the @a swag and NULL otherwise
*
- * removes \a obj from \a swag
+ * removes @a obj from @a swag
*/
static inline void *xbt_swag_remove(void *obj, xbt_swag_t swag)
{
}
/*
- * \param swag a swag
- * \return the number of objects in \a swag
+ * @param swag a swag
+ * @return the number of objects in @a swag
*/
static inline int xbt_swag_size(const_xbt_swag_t swag)
{
- return (swag->count);
+ return swag->count;
}