[asterisk-commits] seanbright: trunk r240368 - in /trunk: apps/ cdr/ cel/ channels/ main/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jan 15 12:21:54 CST 2010
Author: seanbright
Date: Fri Jan 15 12:21:50 2010
New Revision: 240368
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=240368
Log:
Convert a few places to use ast_calloc_with_stringfields where applicable.
Modified:
trunk/apps/app_jack.c
trunk/apps/app_meetme.c
trunk/cdr/cdr_tds.c
trunk/cel/cel_tds.c
trunk/channels/chan_sip.c
trunk/main/features.c
trunk/main/manager.c
trunk/main/pbx.c
trunk/res/res_phoneprov.c
trunk/res/res_smdi.c
Modified: trunk/apps/app_jack.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_jack.c?view=diff&rev=240368&r1=240367&r2=240368
==============================================================================
--- trunk/apps/app_jack.c (original)
+++ trunk/apps/app_jack.c Fri Jan 15 12:21:50 2010
@@ -676,11 +676,7 @@
{
struct jack_data *jack_data;
- if (!(jack_data = ast_calloc(1, sizeof(*jack_data))))
- return NULL;
-
- if (ast_string_field_init(jack_data, 32)) {
- ast_free(jack_data);
+ if (!(jack_data = ast_calloc_with_stringfields(1, struct jack_data, 32))) {
return NULL;
}
Modified: trunk/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_meetme.c?view=diff&rev=240368&r1=240367&r2=240368
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Fri Jan 15 12:21:50 2010
@@ -6166,10 +6166,7 @@
return -1;
}
- if (!(trunk = ast_calloc(1, sizeof(*trunk))))
- return -1;
- if (ast_string_field_init(trunk, 32)) {
- ast_free(trunk);
+ if (!(trunk = ast_calloc_with_stringfields(1, struct sla_trunk, 32))) {
return -1;
}
@@ -6295,10 +6292,7 @@
return -1;
}
- if (!(station = ast_calloc(1, sizeof(*station))))
- return -1;
- if (ast_string_field_init(station, 32)) {
- ast_free(station);
+ if (!(station = ast_calloc_with_stringfields(1, struct sla_station, 32))) {
return -1;
}
Modified: trunk/cdr/cdr_tds.c
URL: http://svnview.digium.com/svn/asterisk/trunk/cdr/cdr_tds.c?view=diff&rev=240368&r1=240367&r2=240368
==============================================================================
--- trunk/cdr/cdr_tds.c (original)
+++ trunk/cdr/cdr_tds.c Fri Jan 15 12:21:50 2010
@@ -538,13 +538,9 @@
dberrhandle(tds_error_handler);
dbmsghandle(tds_message_handler);
- settings = ast_calloc(1, sizeof(*settings));
-
- if (!settings || ast_string_field_init(settings, 256)) {
- if (settings) {
- ast_free(settings);
- settings = NULL;
- }
+ settings = ast_calloc_with_stringfields(1, struct cdr_tds_config, 256);
+
+ if (!settings) {
dbexit();
return AST_MODULE_LOAD_DECLINE;
}
Modified: trunk/cel/cel_tds.c
URL: http://svnview.digium.com/svn/asterisk/trunk/cel/cel_tds.c?view=diff&rev=240368&r1=240367&r2=240368
==============================================================================
--- trunk/cel/cel_tds.c (original)
+++ trunk/cel/cel_tds.c Fri Jan 15 12:21:50 2010
@@ -541,13 +541,9 @@
dberrhandle(tds_error_handler);
dbmsghandle(tds_message_handler);
- settings = ast_calloc(1, sizeof(*settings));
-
- if (!settings || ast_string_field_init(settings, 256)) {
- if (settings) {
- ast_free(settings);
- settings = NULL;
- }
+ settings = ast_calloc_with_stringfields(1, struct cel_tds_config, 256);
+
+ if (!settings) {
dbexit();
return AST_MODULE_LOAD_DECLINE;
}
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=240368&r1=240367&r2=240368
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Jan 15 12:21:50 2010
@@ -7859,14 +7859,8 @@
}
}
- if (!(reg = ast_calloc(1, sizeof(*reg)))) {
+ if (!(reg = ast_calloc_with_stringfields(1, struct sip_registry, 256))) {
ast_log(LOG_ERROR, "Out of memory. Can't allocate SIP registry entry\n");
- return -1;
- }
-
- if (ast_string_field_init(reg, 256)) {
- ast_log(LOG_ERROR, "Out of memory. Can't allocate SIP registry strings\n");
- ast_free(reg);
return -1;
}
@@ -7935,12 +7929,7 @@
}
}
- if (!(mwi = ast_calloc(1, sizeof(*mwi)))) {
- return -1;
- }
-
- if (ast_string_field_init(mwi, 256)) {
- ast_free(mwi);
+ if (!(mwi = ast_calloc_with_stringfields(1, struct sip_subscription_mwi, 256))) {
return -1;
}
Modified: trunk/main/features.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/features.c?view=diff&rev=240368&r1=240367&r2=240368
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Fri Jan 15 12:21:50 2010
@@ -1940,13 +1940,8 @@
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);
@@ -1980,13 +1975,8 @@
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));
Modified: trunk/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager.c?view=diff&rev=240368&r1=240367&r2=240368
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Fri Jan 15 12:21:50 2010
@@ -4430,12 +4430,7 @@
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;
}
Modified: trunk/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/pbx.c?view=diff&rev=240368&r1=240367&r2=240368
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Fri Jan 15 12:21:50 2010
@@ -3114,13 +3114,7 @@
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;
}
Modified: trunk/res/res_phoneprov.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_phoneprov.c?view=diff&rev=240368&r1=240367&r2=240368
==============================================================================
--- trunk/res/res_phoneprov.c (original)
+++ trunk/res/res_phoneprov.c Fri Jan 15 12:21:50 2010
@@ -636,12 +636,7 @@
AST_APP_ARG(mimetype);
);
- if (!(pp_file = ast_calloc(1, sizeof(*pp_file)))) {
- profile = unref_profile(profile);
- return;
- }
- if (ast_string_field_init(pp_file, 32)) {
- ast_free(pp_file);
+ if (!(pp_file = ast_calloc_with_stringfields(1, struct phoneprov_file, 32))) {
profile = unref_profile(profile);
return;
}
@@ -712,13 +707,7 @@
const char *tmp;
int i;
- if (!(exten = ast_calloc(1, sizeof(*exten)))) {
- return NULL;
- }
-
- if (ast_string_field_init(exten, 32)) {
- ast_free(exten);
- exten = NULL;
+ if (!(exten = ast_calloc_with_stringfields(1, struct extension, 32))) {
return NULL;
}
Modified: trunk/res/res_smdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_smdi.c?view=diff&rev=240368&r1=240367&r2=240368
==============================================================================
--- trunk/res/res_smdi.c (original)
+++ trunk/res/res_smdi.c Fri Jan 15 12:21:50 2010
@@ -848,13 +848,8 @@
struct mailbox_mapping *mm;
char *mailbox, *context;
- if (!(mm = ast_calloc(1, sizeof(*mm))))
+ if (!(mm = ast_calloc_with_stringfields(1, struct mailbox_mapping, 32)))
return;
-
- if (ast_string_field_init(mm, 32)) {
- free(mm);
- return;
- }
ast_string_field_set(mm, smdi, var->name);
More information about the asterisk-commits
mailing list