NULL-terminated array. This may solve backward compatibility issues
due to the change to return type of SD_Simulate. See also:
http://lists.gforge.inria.fr/pipermail/simgrid-user/2010-December/002206.html
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8882
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
Simix
* completely rewrote this module to allow parallel execution.
+ XBT
+ * Add a new function xbt_dynar_to_array that transforms a dynar into a
+ NULL-terminated array. This may solve backward compatibility issues
+ due to the change to return type of SD_Simulate. See also:
+ http://lists.gforge.inria.fr/pipermail/simgrid-user/2010-December/002206.html
+
-- Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
SimGrid (3.5) stable; urgency=medium
int_f_cpvoid_cpvoid_t compar_fn);
XBT_INLINE XBT_PUBLIC(int) xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2,
int(*compar)(const void *, const void *));
+XBT_INLINE void * xbt_dynar_to_array (xbt_dynar_t dynar);
/** @} */
/** @defgroup XBT_dynar_perl Perl-like use of dynars
_dynar_unlock(dynar);
}
+/** @brief Transform a dynar into a NULL terminated array
+ *
+ * \param dynar the dynar to transform
+ */
+XBT_INLINE void * xbt_dynar_to_array (xbt_dynar_t dynar)
+{
+ void * last = xbt_new0(char,dynar->elmsize);
+ xbt_dynar_push(dynar, last);
+ free(last);
+ dynar->used--;
+ return dynar->data;
+}
+
/*
* Return 0 if d1 and d2 are equal and 1 if not equal
*/