25 #include "dbus-dataslot.h"
26 #include "dbus-threads-internal.h"
52 allocator->
lock = lock;
74 if (!_dbus_lock (allocator->
lock))
94 while (slot < allocator->n_allocated_slots)
134 _dbus_verbose (
"Allocated slot %d on allocator %p total %d slots allocated %d used\n",
138 _dbus_unlock (allocator->
lock);
157 if (!_dbus_lock (allocator->
lock))
159 "before we allocated this slot");
161 _dbus_assert (*slot_id_p < allocator->n_allocated_slots);
169 _dbus_unlock (allocator->
lock);
174 _dbus_verbose (
"Freeing slot %d on allocator %p total %d allocated %d used\n",
189 _dbus_unlock (allocator->
lock);
229 #ifndef DBUS_DISABLE_ASSERT
234 if (!_dbus_lock (allocator->
lock))
236 "before we allocated this slot");
240 _dbus_unlock (allocator->
lock);
256 while (i < list->n_slots)
289 #ifndef DBUS_DISABLE_ASSERT
294 if (!_dbus_lock (allocator->
lock))
296 "before we allocated this slot");
301 _dbus_unlock (allocator->
lock);
322 while (i < list->n_slots)
351 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
352 #include "dbus-test.h"
355 static int free_counter;
358 test_free_slot_data_func (
void *data)
370 _dbus_data_slot_test (
void)
408 test_free_slot_data_func,
409 &old_free_func, &old_data))
428 test_free_slot_data_func,
429 &old_free_func, &old_data))
432 _dbus_assert (old_free_func == test_free_slot_data_func);
435 (* old_free_func) (old_data);