{
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;
}
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;
}
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;
}
dberrhandle(tds_error_handler);
dbmsghandle(tds_message_handler);
- settings = ast_calloc(1, sizeof(*settings));
+ settings = ast_calloc_with_stringfields(1, struct cdr_tds_config, 256);
- if (!settings || ast_string_field_init(settings, 256)) {
- if (settings) {
- ast_free(settings);
- settings = NULL;
- }
+ if (!settings) {
dbexit();
return AST_MODULE_LOAD_DECLINE;
}
dberrhandle(tds_error_handler);
dbmsghandle(tds_message_handler);
- settings = ast_calloc(1, sizeof(*settings));
+ settings = ast_calloc_with_stringfields(1, struct cel_tds_config, 256);
- if (!settings || ast_string_field_init(settings, 256)) {
- if (settings) {
- ast_free(settings);
- settings = NULL;
- }
+ if (!settings) {
dbexit();
return AST_MODULE_LOAD_DECLINE;
}
}
}
- 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;
- }
-
ast_atomic_fetchadd_int(®objs, 1);
ASTOBJ_INIT(reg);
ast_string_field_set(reg, callback, ast_strip_quoted(S_OR(host2.extension, "s"), "\"", "\""));
}
}
- 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;
}
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);
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;
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;
}
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;
}
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;
}
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;
}
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);