Functions | |
dbus_bool_t | _dbus_data_slot_allocator_init (DBusDataSlotAllocator *allocator) |
Initializes a data slot allocator object, used to assign integer IDs for data slots. More... | |
dbus_bool_t | _dbus_data_slot_allocator_alloc (DBusDataSlotAllocator *allocator, DBusMutex *mutex, dbus_int32_t *slot_id_p) |
Allocates an integer ID to be used for storing data in a DBusDataSlotList. More... | |
void | _dbus_data_slot_allocator_free (DBusDataSlotAllocator *allocator, dbus_int32_t *slot_id_p) |
Deallocates an ID previously allocated with _dbus_data_slot_allocator_alloc(). More... | |
void | _dbus_data_slot_list_init (DBusDataSlotList *list) |
Initializes a slot list. More... | |
dbus_bool_t | _dbus_data_slot_list_set (DBusDataSlotAllocator *allocator, DBusDataSlotList *list, int slot, void *data, DBusFreeFunction free_data_func, DBusFreeFunction *old_free_func, void **old_data) |
Stores a pointer in the data slot list, along with an optional function to be used for freeing the data when the data is set again, or when the slot list is finalized. More... | |
void * | _dbus_data_slot_list_get (DBusDataSlotAllocator *allocator, DBusDataSlotList *list, int slot) |
Retrieves data previously set with _dbus_data_slot_list_set_data(). More... | |
void | _dbus_data_slot_list_free (DBusDataSlotList *list) |
Frees the data slot list and all data slots contained in it, calling application-provided free functions if they exist. More... |
Types and functions related to storing data by an allocated ID. This is used for dbus_connection_set_data(), dbus_server_set_data(), etc.
|
Allocates an integer ID to be used for storing data in a DBusDataSlotList. If the value at *slot_id_p is not -1, this function just increments the refcount for the existing slot ID. If the value is -1, a new slot ID is allocated and stored at *slot_id_p.
Definition at line 67 of file dbus-dataslot.c. References DBusDataSlotAllocator::allocated_slots, DBusDataSlotAllocator::lock, DBusDataSlotAllocator::n_allocated_slots, DBusDataSlotAllocator::n_used_slots, DBusAllocatedSlot::refcount, and DBusAllocatedSlot::slot_id. |
|
Deallocates an ID previously allocated with _dbus_data_slot_allocator_alloc(). Existing data stored on existing DBusDataList objects with this ID will be freed when the data list is finalized, but may not be retrieved (and may only be replaced if someone else reallocates the slot). The slot value is reset to -1 if this is the last unref.
Definition at line 161 of file dbus-dataslot.c. References DBusDataSlotAllocator::allocated_slots, DBusDataSlotAllocator::lock, DBusDataSlotAllocator::n_allocated_slots, DBusDataSlotAllocator::n_used_slots, DBusAllocatedSlot::refcount, and DBusAllocatedSlot::slot_id. |
|
Initializes a data slot allocator object, used to assign integer IDs for data slots.
Definition at line 44 of file dbus-dataslot.c. References DBusDataSlotAllocator::allocated_slots, DBusDataSlotAllocator::lock, DBusDataSlotAllocator::n_allocated_slots, and DBusDataSlotAllocator::n_used_slots. |
|
Frees the data slot list and all data slots contained in it, calling application-provided free functions if they exist.
Definition at line 326 of file dbus-dataslot.c. References data, free_data_func, DBusDataSlotList::n_slots, and DBusDataSlotList::slots. |
|
Retrieves data previously set with _dbus_data_slot_list_set_data(). The slot must still be allocated (must not have been freed).
Definition at line 295 of file dbus-dataslot.c. References DBusDataSlotAllocator::allocated_slots, data, DBusDataSlotAllocator::lock, DBusDataSlotList::n_slots, DBusAllocatedSlot::slot_id, and DBusDataSlotList::slots. |
|
Initializes a slot list.
Definition at line 209 of file dbus-dataslot.c. References DBusDataSlotList::n_slots, and DBusDataSlotList::slots. |
|
Stores a pointer in the data slot list, along with an optional function to be used for freeing the data when the data is set again, or when the slot list is finalized. The slot number must have been allocated with _dbus_data_slot_allocator_alloc() for the same allocator passed in here. The same allocator has to be used with the slot list every time.
Definition at line 233 of file dbus-dataslot.c. References DBusDataSlotAllocator::allocated_slots, data, free_data_func, DBusDataSlotAllocator::lock, DBusDataSlotList::n_slots, DBusAllocatedSlot::slot_id, and DBusDataSlotList::slots. |