static int internal_ao2_ref(void *user_data, const int delta);
static struct ao2_container *internal_ao2_container_alloc(struct ao2_container *c, const uint n_buckets, ao2_hash_fn *hash_fn,
ao2_callback_fn *cmp_fn);
-static struct bucket_list *internal_ao2_link(struct ao2_container *c, void *user_data, const char *file, int line, const char *func);
+static struct bucket_entry *internal_ao2_link(struct ao2_container *c, void *user_data, const char *file, int line, const char *func);
static void *internal_ao2_callback(struct ao2_container *c,
const enum search_flags flags, void *cb_fn, void *arg, void *data, enum ao2_callback_type type,
char *tag, char *file, int line, const char *funcname);
-static void *internal_ao2_iterator_next(struct ao2_iterator *a, struct bucket_list **q);
+static void *internal_ao2_iterator_next(struct ao2_iterator *a, struct bucket_entry **q);
int __ao2_lock(void *user_data, const char *file, const char *func, int line, const char *var)
{
static void container_destruct_debug(void *c);
/* each bucket in the container is a tailq. */
-AST_LIST_HEAD_NOLOCK(bucket, bucket_list);
+AST_LIST_HEAD_NOLOCK(bucket, bucket_entry);
/*!
* A container; stores the hash and callback functions, information on
*
* \todo Linking and unlink objects is typically expensive, as it
* involves a malloc() of a small object which is very inefficient.
- * To optimize this, we allocate larger arrays of bucket_list's
+ * To optimize this, we allocate larger arrays of bucket_entry's
* when we run out of them, and then manage our own freelist.
* This will be more efficient as we can do the freelist management while
* we hold the lock (that we need anyways).
* used within a bucket.
* XXX \todo this should be private to the container code
*/
-struct bucket_list {
- AST_LIST_ENTRY(bucket_list) entry;
+struct bucket_entry {
+ AST_LIST_ENTRY(bucket_entry) entry;
int version;
struct astobj2 *astobj; /* pointer to internal data */
};
* link an object to a container
*/
-static struct bucket_list *internal_ao2_link(struct ao2_container *c, void *user_data, const char *file, int line, const char *func)
+static struct bucket_entry *internal_ao2_link(struct ao2_container *c, void *user_data, const char *file, int line, const char *func)
{
int i;
/* create a new list entry */
- struct bucket_list *p;
+ struct bucket_entry *p;
struct astobj2 *obj = INTERNAL_OBJ(user_data);
if (obj == NULL)
void *__ao2_link_debug(struct ao2_container *c, void *user_data, char *tag, char *file, int line, const char *funcname)
{
- struct bucket_list *p = internal_ao2_link(c, user_data, file, line, funcname);
+ struct bucket_entry *p = internal_ao2_link(c, user_data, file, line, funcname);
if (p) {
__ao2_ref_debug(user_data, +1, tag, file, line, funcname);
void *__ao2_link(struct ao2_container *c, void *user_data)
{
- struct bucket_list *p = internal_ao2_link(c, user_data, __FILE__, __LINE__, __PRETTY_FUNCTION__);
+ struct bucket_entry *p = internal_ao2_link(c, user_data, __FILE__, __LINE__, __PRETTY_FUNCTION__);
if (p) {
__ao2_ref(user_data, +1);
/*
* Unlink an object from the container
- * and destroy the associated * ao2_bucket_list structure.
+ * and destroy the associated * bucket_entry structure.
*/
void *__ao2_unlink_debug(struct ao2_container *c, void *user_data, char *tag,
char *file, int line, const char *funcname)
for (; i < last ; i++) {
/* scan the list with prev-cur pointers */
- struct bucket_list *cur;
+ struct bucket_entry *cur;
AST_LIST_TRAVERSE_SAFE_BEGIN(&c->buckets[i], cur, entry) {
int match = (CMP_MATCH | CMP_STOP);
/*
* move to the next element in the container.
*/
-static void *internal_ao2_iterator_next(struct ao2_iterator *a, struct bucket_list **q)
+static void *internal_ao2_iterator_next(struct ao2_iterator *a, struct bucket_entry **q)
{
int lim;
- struct bucket_list *p = NULL;
+ struct bucket_entry *p = NULL;
void *ret = NULL;
*q = NULL;
void *__ao2_iterator_next_debug(struct ao2_iterator *a, char *tag, char *file, int line, const char *funcname)
{
- struct bucket_list *p;
+ struct bucket_entry *p;
void *ret = NULL;
ret = internal_ao2_iterator_next(a, &p);
void *__ao2_iterator_next(struct ao2_iterator *a)
{
- struct bucket_list *p = NULL;
+ struct bucket_entry *p = NULL;
void *ret = NULL;
ret = internal_ao2_iterator_next(a, &p);
__ao2_callback(c, OBJ_UNLINK, cd_cb, NULL);
for (i = 0; i < c->n_buckets; i++) {
- struct bucket_list *current;
+ struct bucket_entry *current;
while ((current = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
ast_free(current);
__ao2_callback_debug(c, OBJ_UNLINK, cd_cb_debug, NULL, "container_destruct_debug called", __FILE__, __LINE__, __PRETTY_FUNCTION__);
for (i = 0; i < c->n_buckets; i++) {
- struct bucket_list *current;
+ struct bucket_entry *current;
while ((current = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
ast_free(current);