"dynar %p is empty", dynar)
static void _dynar_map(const xbt_dynar_t dynar,
- void_f_pvoid_t * const op);
+ void_f_pvoid_t const op);
static XBT_INLINE
void _xbt_clear_mem(void * const ptr,
static XBT_INLINE
void
_xbt_dynar_expand(xbt_dynar_t const dynar,
- const int nb) {
+ const unsigned long nb) {
const unsigned long old_size = dynar->size;
if (nb > old_size) {
const unsigned long new_length = new_size*elmsize;
char * const new_data = (char *) xbt_malloc0(elmsize*new_size);
- DEBUG3("expend %p from %lu to %d elements", (void*)dynar, (unsigned long)old_size, nb);
+ DEBUG3("expend %p from %lu to %lu elements", (void*)dynar, (unsigned long)old_size, nb);
if (old_data) {
memcpy(new_data, old_data, used_length);
static XBT_INLINE
void
_xbt_dynar_remove_at(xbt_dynar_t const dynar,
- const int idx,
+ const unsigned long idx,
void * const object) {
unsigned long nb_shift;
*/
xbt_dynar_t
xbt_dynar_new(const unsigned long elmsize,
- void_f_pvoid_t * const free_f) {
+ void_f_pvoid_t const free_f) {
xbt_dynar_t dynar = xbt_new0(s_xbt_dynar_t,1);
*/
xbt_dynar_t
xbt_dynar_new_sync(const unsigned long elmsize,
- void_f_pvoid_t * const free_f) {
+ void_f_pvoid_t const free_f) {
xbt_dynar_t res = xbt_dynar_new(elmsize,free_f);
res->mutex = xbt_mutex_init();
return res;
* array is not expanded and nothing is done.
*/
void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted) {
- int size_wanted;
+ unsigned long size_wanted;
_dynar_lock(dynar);
*/
void
xbt_dynar_get_cpy(const xbt_dynar_t dynar,
- const int idx,
+ const unsigned long idx,
void * const dst) {
_dynar_lock(dynar);
_sanity_check_dynar(dynar);
* Make a copy before fooling with it.
*/
void*
-xbt_dynar_get_ptr(const xbt_dynar_t dynar, const int idx) {
+xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx) {
void *res;
_dynar_lock(dynar);
static void XBT_INLINE /* not synchronized */
_xbt_dynar_set(xbt_dynar_t dynar,
- const int idx,
+ const unsigned long idx,
const void * const src) {
_sanity_check_dynar(dynar);
*/
void
xbt_dynar_replace(xbt_dynar_t dynar,
- const int idx,
+ const unsigned long idx,
const void * const object) {
_dynar_lock(dynar);
_sanity_check_dynar(dynar);
if (idx < dynar->used && dynar->free_f) {
void * const old_object = _xbt_dynar_elm(dynar, idx);
- dynar->free_f(old_object);
+ (*(dynar->free_f))(old_object);
}
_xbt_dynar_set(dynar, idx, object);
static XBT_INLINE void *
_xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
- const int idx) {
+ const unsigned long idx) {
void *res;
unsigned long old_used;
unsigned long new_used;
int
xbt_dynar_search(xbt_dynar_t const dynar,
void *const elem) {
- int it;
+ unsigned long it;
_dynar_lock(dynar);
for (it=0; it< dynar->used; it++)
}
static void _dynar_map(const xbt_dynar_t dynar,
- void_f_pvoid_t * const op) {
+ void_f_pvoid_t const op) {
char elm[SIZEOF_MAX];
const unsigned long used = dynar->used;
unsigned long i = 0;
for (i = 0; i < used; i++) {
_xbt_dynar_get_elm(elm, dynar, i);
- op(elm);
+ (*op)(elm);
}
}
*/
void
xbt_dynar_map(const xbt_dynar_t dynar,
- void_f_pvoid_t * const op) {
+ void_f_pvoid_t const op) {
_dynar_lock(dynar);
_sanity_check_dynar(dynar);
_sanity_check_dynar(dynar);
{
- const int idx = *cursor;
+ const unsigned long idx = *cursor;
if (idx >= dynar->used) {
DEBUG1("Cursor on %p already on last elem",(void*)dynar);
_dynar_unlock(dynar);
return FALSE;
}
- DEBUG2("Cash out cursor on %p at %d",(void*)dynar,idx);
+ DEBUG2("Cash out cursor on %p at %lu",(void*)dynar,idx);
_xbt_dynar_get_elm(dst, dynar, idx);
}