diff options
author | George Joseph <george.joseph@fairview5.com> | 2016-04-13 12:38:01 -0600 |
---|---|---|
committer | George Joseph <george.joseph@fairview5.com> | 2016-04-13 14:01:37 -0600 |
commit | caa416d5f305526c1ef7ed9065ab5361d87ebba1 (patch) | |
tree | f47a773afe7f437bd6650dd23f88a6fc10e279c8 /include/asterisk/stringfields.h | |
parent | fddec0c2664a65b5ffa18894af60bf4d81a7dafc (diff) |
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
Diffstat (limited to 'include/asterisk/stringfields.h')
-rw-r--r-- | include/asterisk/stringfields.h | 21 |
1 files changed, 6 insertions, 15 deletions
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 @@ -222,21 +222,12 @@ 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__; \ }) |