@ -137,11 +137,11 @@ enum ao2_callback_type {
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 )
{
@ -348,7 +348,7 @@ static void container_destruct(void *c);
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
@ -367,7 +367,7 @@ AST_LIST_HEAD_NOLOCK(bucket, bucket_list);
*
* \ 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 ) .
@ -461,8 +461,8 @@ int ao2_container_count(struct ao2_container *c)
* 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 */
} ;
@ -471,11 +471,11 @@ struct bucket_list {
* 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 )
@ -503,7 +503,7 @@ static struct bucket_list *internal_ao2_link(struct ao2_container *c, void *user
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 ) ;
@ -514,7 +514,7 @@ void *__ao2_link_debug(struct ao2_container *c, void *user_data, char *tag, char
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 ) ;
@ -533,7 +533,7 @@ int ao2_match_by_addr(void *user_data, void *arg, int flags)
/*
* 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 )
@ -658,7 +658,7 @@ static void *internal_ao2_callback(struct ao2_container *c,
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 ) ;
@ -823,10 +823,10 @@ void ao2_iterator_destroy(struct ao2_iterator *i)
/*
* 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 ;
@ -892,7 +892,7 @@ found:
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 ) ;
@ -910,7 +910,7 @@ void *__ao2_iterator_next_debug(struct ao2_iterator *a, char *tag, char *file, i
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 ) ;
@ -949,7 +949,7 @@ static void container_destruct(void *_c)
__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 ) ;
@ -969,7 +969,7 @@ static void container_destruct_debug(void *_c)
__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 ) ;