diff options
author | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-01-15 18:21:50 +0000 |
---|---|---|
committer | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-01-15 18:21:50 +0000 |
commit | adc69e041d2b415b3422672fb262423808dfa8ab (patch) | |
tree | ede1629dadd9e525779f3da8f54510a9dd1ea081 /main | |
parent | a79e0451bce168a451e7ed1e30226166e58e203c (diff) |
Convert a few places to use ast_calloc_with_stringfields where applicable.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@240368 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/features.c | 14 | ||||
-rw-r--r-- | main/manager.c | 7 | ||||
-rw-r--r-- | main/pbx.c | 8 |
3 files changed, 4 insertions, 25 deletions
diff --git a/main/features.c b/main/features.c index 8ba195571..68f2f858a 100644 --- a/main/features.c +++ b/main/features.c @@ -1940,14 +1940,9 @@ static struct feature_group* register_group(const char *fgname) return NULL; } - if (!(fg = ast_calloc(1, sizeof(*fg)))) + if (!(fg = ast_calloc_with_stringfields(1, struct feature_group, 128))) return NULL; - if (ast_string_field_init(fg, 128)) { - ast_free(fg); - return NULL; - } - ast_string_field_set(fg, gname, fgname); AST_LIST_INSERT_HEAD(&feature_groups, fg, entry); @@ -1980,14 +1975,9 @@ static void register_group_feature(struct feature_group *fg, const char *exten, return; } - if (!(fge = ast_calloc(1, sizeof(*fge)))) + if (!(fge = ast_calloc_with_stringfields(1, struct feature_group_exten, 128))) return; - if (ast_string_field_init(fge, 128)) { - ast_free(fge); - return; - } - ast_string_field_set(fge, exten, S_OR(exten, feature->exten)); fge->feature = feature; diff --git a/main/manager.c b/main/manager.c index e7cf931e1..3af61b37f 100644 --- a/main/manager.c +++ b/main/manager.c @@ -4430,12 +4430,7 @@ int ast_manager_register2(const char *action, int auth, int (*func)(struct manse char *tmpxml; #endif - if (!(cur = ast_calloc(1, sizeof(*cur)))) { - return -1; - } - - if (ast_string_field_init(cur, 128)) { - ast_free(cur); + if (!(cur = ast_calloc_with_stringfields(1, struct manager_action, 128))) { return -1; } diff --git a/main/pbx.c b/main/pbx.c index b9ba3fb79..520e3365b 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -3114,13 +3114,7 @@ int pbx_builtin_raise_exception(struct ast_channel *chan, const char *reason) ds = ast_datastore_alloc(&exception_store_info, NULL); if (!ds) return -1; - exception = ast_calloc(1, sizeof(struct pbx_exception)); - if (!exception) { - ast_datastore_free(ds); - return -1; - } - if (ast_string_field_init(exception, 128)) { - ast_free(exception); + if (!(exception = ast_calloc_with_stringfields(1, struct pbx_exception, 128))) { ast_datastore_free(ds); return -1; } |