@ -52,8 +52,10 @@ struct __priv_data {
ao2_destructor_fn destructor_fn ;
ao2_destructor_fn destructor_fn ;
/*! This field is used for astobj2 and ao2_weakproxy objects to reference each other */
/*! This field is used for astobj2 and ao2_weakproxy objects to reference each other */
void * weakptr ;
void * weakptr ;
# if defined(AO2_DEBUG)
/*! User data size for stats */
/*! User data size for stats */
size_t data_size ;
size_t data_size ;
# endif
/*! The ao2 object option flags */
/*! The ao2 object option flags */
uint32_t options ;
uint32_t options ;
/*! magic number. This is used to verify that a pointer passed in is a
/*! magic number. This is used to verify that a pointer passed in is a
@ -669,11 +671,11 @@ static void *internal_ao2_alloc(size_t data_size, ao2_destructor_fn destructor_f
/* Initialize common ao2 values. */
/* Initialize common ao2 values. */
obj - > priv_data . ref_counter = 1 ;
obj - > priv_data . ref_counter = 1 ;
obj - > priv_data . destructor_fn = destructor_fn ; /* can be NULL */
obj - > priv_data . destructor_fn = destructor_fn ; /* can be NULL */
obj - > priv_data . data_size = data_size ;
obj - > priv_data . options = options ;
obj - > priv_data . options = options ;
obj - > priv_data . magic = AO2_MAGIC ;
obj - > priv_data . magic = AO2_MAGIC ;
# ifdef AO2_DEBUG
# ifdef AO2_DEBUG
obj - > priv_data . data_size = data_size ;
ast_atomic_fetchadd_int ( & ao2 . total_objects , 1 ) ;
ast_atomic_fetchadd_int ( & ao2 . total_objects , 1 ) ;
ast_atomic_fetchadd_int ( & ao2 . total_mem , data_size ) ;
ast_atomic_fetchadd_int ( & ao2 . total_mem , data_size ) ;
ast_atomic_fetchadd_int ( & ao2 . total_refs , 1 ) ;
ast_atomic_fetchadd_int ( & ao2 . total_refs , 1 ) ;