* New data container: setset (set of sets of elements)
* New module: mmalloc (mapped malloc)
* New function: xbt_dict_cursor_set_data()
+ * New function: xbt_dynar_sort()
* New function: xbt_fifo_get_last_item()
* Bug fix in xbt_dynar_shrink(): use the right element size
* Use library init/fini functions for our initialization.
XBT_PUBLIC(int) xbt_dynar_search(xbt_dynar_t const dynar, void *elem);
XBT_PUBLIC(int) xbt_dynar_member(xbt_dynar_t const dynar, void *elem);
+XBT_PUBLIC(void) xbt_dynar_sort(xbt_dynar_t const dynar, int_f_pvoid_pvoid_t compar_fn);
+
/** @} */
/** @defgroup XBT_dynar_perl Perl-like use of dynars
* @ingroup XBT_dynar
_dynar_unlock(dynar);
}
+/** @brief Sorts a dynar according to the function <tt>compar_fn</tt>
+ *
+ * \param compar_fn comparison function of type (int (compar_fn*) (void*) (void*)).
+ *
+ * Remark: if the elements stored in the dynar are structures, the compar_fn
+ * function has to retrieve the field to sort first.
+ */
+XBT_INLINE void xbt_dynar_sort(xbt_dynar_t dynar, int_f_pvoid_pvoid_t compar_fn){
+
+ _dynar_lock(dynar);
+
+ qsort(dynar->data, dynar->used, dynar->elmsize, compar_fn);
+
+ _dynar_unlock(dynar);
+}
+
#ifdef SIMGRID_TEST
#define NB_ELEM 5000