@ -228,11 +228,6 @@ struct ast_string_field_mgr {
ast_string_field last_alloc ; /*!< the last field allocated */
ast_string_field last_alloc ; /*!< the last field allocated */
struct ast_string_field_pool * embedded_pool ; /*!< pointer to the embedded pool, if any */
struct ast_string_field_pool * embedded_pool ; /*!< pointer to the embedded pool, if any */
struct ast_string_field_vector string_fields ; /*!< field vector for compare and copy */
struct ast_string_field_vector string_fields ; /*!< field vector for compare and copy */
/* v-- MALLOC_DEBUG information */
const char * owner_file ; /*!< filename of owner */
const char * owner_func ; /*!< function name of owner */
int owner_line ; /*!< line number of owner */
/* ^-- MALLOC_DEBUG information */
} ;
} ;
/*!
/*!
@ -266,7 +261,8 @@ int __ast_string_field_ptr_grow(struct ast_string_field_mgr *mgr,
an additional pool will be allocated .
an additional pool will be allocated .
*/
*/
ast_string_field __ast_string_field_alloc_space ( struct ast_string_field_mgr * mgr ,
ast_string_field __ast_string_field_alloc_space ( struct ast_string_field_mgr * mgr ,
struct ast_string_field_pool * * pool_head , size_t needed ) ;
struct ast_string_field_pool * * pool_head , size_t needed ,
const char * file , int lineno , const char * func ) ;
/*!
/*!
\ internal
\ internal
@ -277,9 +273,9 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr
\ param format printf - style format string
\ param format printf - style format string
\ return nothing
\ return nothing
*/
*/
void __ast_string_field_ptr_build ( struct ast_string_field_mgr * mgr ,
void __ast_string_field_ptr_build ( const char * file , int lineno , const char * func ,
struct ast_string_field_pool * * pool_head ,
struct ast_string_field_mgr * mgr , struct ast_string_field_pool * * pool_head ,
ast_string_field * ptr , const char * format , . . . ) __attribute__ ( ( format ( printf , 4, 5 ) ) ) ;
ast_string_field * ptr , const char * format , . . . ) __attribute__ ( ( format ( printf , 7, 8 ) ) ) ;
/*!
/*!
\ internal
\ internal
@ -293,7 +289,8 @@ void __ast_string_field_ptr_build(struct ast_string_field_mgr *mgr,
*/
*/
void __ast_string_field_ptr_build_va ( struct ast_string_field_mgr * mgr ,
void __ast_string_field_ptr_build_va ( struct ast_string_field_mgr * mgr ,
struct ast_string_field_pool * * pool_head ,
struct ast_string_field_pool * * pool_head ,
ast_string_field * ptr , const char * format , va_list ap ) __attribute__ ( ( format ( printf , 4 , 0 ) ) ) ;
ast_string_field * ptr , const char * format , va_list ap ,
const char * file , int lineno , const char * func ) __attribute__ ( ( format ( printf , 4 , 0 ) ) ) ;
/*!
/*!
\ brief Declare a string field
\ brief Declare a string field
@ -479,7 +476,7 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
__res__ ; \
__res__ ; \
} )
} )
# define ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data) \
# define __ ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data, file, lineno, func) \
( { \
( { \
int __res__ = 0 ; \
int __res__ = 0 ; \
const char * __d__ = ( data ) ; \
const char * __d__ = ( data ) ; \
@ -491,7 +488,7 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
* __p__ = __ast_string_field_empty ; \
* __p__ = __ast_string_field_empty ; \
} else if ( ( __dlen__ < = AST_STRING_FIELD_ALLOCATION ( * __p__ ) ) | | \
} else if ( ( __dlen__ < = AST_STRING_FIELD_ALLOCATION ( * __p__ ) ) | | \
( ! __ast_string_field_ptr_grow ( & field_mgr , & field_mgr_pool , __dlen__ , __p__ ) ) | | \
( ! __ast_string_field_ptr_grow ( & field_mgr , & field_mgr_pool , __dlen__ , __p__ ) ) | | \
( target = __ast_string_field_alloc_space ( & field_mgr , & field_mgr_pool , __dlen__ )) ) { \
( target = __ast_string_field_alloc_space ( & field_mgr , & field_mgr_pool , __dlen__ , file , lineno , func )) ) { \
if ( target ! = * __p__ ) { \
if ( target ! = * __p__ ) { \
__ast_string_field_release_active ( field_mgr_pool , * __p__ ) ; \
__ast_string_field_release_active ( field_mgr_pool , * __p__ ) ; \
* __p__ = target ; \
* __p__ = target ; \
@ -503,6 +500,9 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
__res__ ; \
__res__ ; \
} )
} )
# define ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data) \
__ast_string_field_ptr_set_by_fields ( field_mgr_pool , field_mgr , ptr , data , __FILE__ , __LINE__ , __PRETTY_FUNCTION__ )
/*!
/*!
\ brief Set a field to a simple string value
\ brief Set a field to a simple string value
\ param x Pointer to a structure containing fields
\ param x Pointer to a structure containing fields
@ -532,7 +532,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
( { \
( { \
int __res__ = - 1 ; \
int __res__ = - 1 ; \
if ( ( ( void * ) ( x ) ) ! = NULL ) { \
if ( ( ( void * ) ( x ) ) ! = NULL ) { \
__ast_string_field_ptr_build ( & ( x ) - > __field_mgr , & ( x ) - > __field_mgr_pool , ( ast_string_field * ) ptr , fmt , args ) ; \
__ast_string_field_ptr_build ( __FILE__ , __LINE__ , __PRETTY_FUNCTION__ , \
& ( x ) - > __field_mgr , & ( x ) - > __field_mgr_pool , ( ast_string_field * ) ptr , fmt , args ) ; \
__res__ = 0 ; \
__res__ = 0 ; \
} \
} \
__res__ ; \
__res__ ; \
@ -550,7 +551,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
( { \
( { \
int __res__ = - 1 ; \
int __res__ = - 1 ; \
if ( ( ( void * ) ( x ) ) ! = NULL ) { \
if ( ( ( void * ) ( x ) ) ! = NULL ) { \
__ast_string_field_ptr_build ( & ( x ) - > __field_mgr , & ( x ) - > __field_mgr_pool , ( ast_string_field * ) & ( x ) - > field , fmt , args ) ; \
__ast_string_field_ptr_build ( __FILE__ , __LINE__ , __PRETTY_FUNCTION__ , \
& ( x ) - > __field_mgr , & ( x ) - > __field_mgr_pool , ( ast_string_field * ) & ( x ) - > field , fmt , args ) ; \
__res__ = 0 ; \
__res__ = 0 ; \
} \
} \
__res__ ; \
__res__ ; \
@ -568,7 +570,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
( { \
( { \
int __res__ = - 1 ; \
int __res__ = - 1 ; \
if ( ( ( void * ) ( x ) ) ! = NULL ) { \
if ( ( ( void * ) ( x ) ) ! = NULL ) { \
__ast_string_field_ptr_build_va ( & ( x ) - > __field_mgr , & ( x ) - > __field_mgr_pool , ( ast_string_field * ) ptr , fmt , args ) ; \
__ast_string_field_ptr_build_va ( & ( x ) - > __field_mgr , & ( x ) - > __field_mgr_pool , ( ast_string_field * ) ptr , fmt , args , \
__FILE__ , __LINE__ , __PRETTY_FUNCTION__ ) ; \
__res__ = 0 ; \
__res__ = 0 ; \
} \
} \
__res__ ; \
__res__ ; \
@ -586,7 +589,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
( { \
( { \
int __res__ = - 1 ; \
int __res__ = - 1 ; \
if ( ( ( void * ) ( x ) ) ! = NULL ) { \
if ( ( ( void * ) ( x ) ) ! = NULL ) { \
__ast_string_field_ptr_build_va ( & ( x ) - > __field_mgr , & ( x ) - > __field_mgr_pool , ( ast_string_field * ) & ( x ) - > field , fmt , args ) ; \
__ast_string_field_ptr_build_va ( & ( x ) - > __field_mgr , & ( x ) - > __field_mgr_pool , ( ast_string_field * ) & ( x ) - > field , fmt , args , \
__FILE__ , __LINE__ , __PRETTY_FUNCTION__ ) ; \
__res__ = 0 ; \
__res__ = 0 ; \
} \
} \
__res__ ; \
__res__ ; \
@ -626,12 +630,14 @@ int __ast_string_fields_cmp(struct ast_string_field_vector *left, struct ast_str
if ( ( ( void * ) ( copy ) ) ! = NULL & & ( ( void * ) ( orig ) ) ! = NULL ) { \
if ( ( ( void * ) ( copy ) ) ! = NULL & & ( ( void * ) ( orig ) ) ! = NULL ) { \
__res__ = __ast_string_fields_copy ( ( ( copy ) - > __field_mgr_pool ) , \
__res__ = __ast_string_fields_copy ( ( ( copy ) - > __field_mgr_pool ) , \
( struct ast_string_field_mgr * ) & ( ( copy ) - > __field_mgr ) , \
( struct ast_string_field_mgr * ) & ( ( copy ) - > __field_mgr ) , \
( struct ast_string_field_mgr * ) & ( ( orig ) - > __field_mgr ) ) ; \
( struct ast_string_field_mgr * ) & ( ( orig ) - > __field_mgr ) , \
__FILE__ , __LINE__ , __PRETTY_FUNCTION__ ) ; \
} \
} \
__res__ ; \
__res__ ; \
} )
} )
int __ast_string_fields_copy ( struct ast_string_field_pool * copy_pool ,
int __ast_string_fields_copy ( struct ast_string_field_pool * copy_pool ,
struct ast_string_field_mgr * copy_mgr , struct ast_string_field_mgr * orig_mgr ) ;
struct ast_string_field_mgr * copy_mgr , struct ast_string_field_mgr * orig_mgr ,
const char * file , int lineno , const char * func ) ;
# endif /* _ASTERISK_STRINGFIELDS_H */
# endif /* _ASTERISK_STRINGFIELDS_H */