From caa416d5f305526c1ef7ed9065ab5361d87ebba1 Mon Sep 17 00:00:00 2001 From: George Joseph Date: Wed, 13 Apr 2016 12:38:01 -0600 Subject: stringfields: Update extended string fields for master only. In 13, the new ast_string_field_header structure had to be dynamically allocated and assigned to a pointer in ast_string_field_mgr to preserve ABI compatability. In master, it can be converted to being a structure-in-place in ast_string_field_mgr to eliminate the extra alloc and free calls. Change-Id: Ia97c5345eec68717a15dc16fe2e6746ff2a926f4 --- include/asterisk/stringfields.h | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'include/asterisk/stringfields.h') diff --git a/include/asterisk/stringfields.h b/include/asterisk/stringfields.h index c24424b0a..24f945b26 100644 --- a/include/asterisk/stringfields.h +++ b/include/asterisk/stringfields.h @@ -220,23 +220,14 @@ struct ast_string_field_pool { */ AST_VECTOR(ast_string_field_vector, const char **); -/*! - \internal - \brief Structure used to hold a pointer to the embedded pool and the field vector - \since 13.9.0 -*/ -struct ast_string_field_header { - 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 */ -}; - /*! \internal \brief Structure used to manage the storage for a set of string fields. */ struct ast_string_field_mgr { ast_string_field last_alloc; /*!< the last field allocated */ - struct ast_string_field_header *header; /*!< pointer to the header */ + 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 */ #if defined(__AST_DEBUG_MALLOC) const char *owner_file; /*!< filename of owner */ const char *owner_func; /*!< function name of owner */ @@ -407,10 +398,10 @@ int __ast_string_field_free_memory(struct ast_string_field_mgr *mgr, #define ast_string_field_init_extended(x, field) \ ({ \ int __res__ = -1; \ - if (((void *)(x)) != NULL && (x)->__field_mgr.header != NULL) { \ + if (((void *)(x)) != NULL) { \ ast_string_field *non_const = (ast_string_field *)&(x)->field; \ *non_const = __ast_string_field_empty; \ - __res__ = AST_VECTOR_APPEND(&(x)->__field_mgr.header->string_fields, non_const); \ + __res__ = AST_VECTOR_APPEND(&(x)->__field_mgr.string_fields, non_const); \ } \ __res__; \ }) @@ -613,8 +604,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, ({ \ int __res__ = -1; \ if (((void *)(instance1)) != NULL && ((void *)(instance2)) != NULL) { \ - __res__ = __ast_string_fields_cmp(&(instance1)->__field_mgr.header->string_fields, \ - &(instance2)->__field_mgr.header->string_fields); \ + __res__ = __ast_string_fields_cmp(&(instance1)->__field_mgr.string_fields, \ + &(instance2)->__field_mgr.string_fields); \ } \ __res__; \ }) -- cgit v1.2.3