mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-18 02:32:36 +00:00
Backport fix for 11520--for some reason I didn't do this back in February when I patched for trunk.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@121992 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
12
main/app.c
12
main/app.c
@@ -1387,6 +1387,18 @@ char *ast_read_textfile(const char *filename)
|
||||
return output;
|
||||
}
|
||||
|
||||
void ast_app_options2str(const struct ast_app_option *options, struct ast_flags *flags, char *buf, size_t len)
|
||||
{
|
||||
unsigned int i, found = 0;
|
||||
|
||||
for (i = 32; i < 128 && found < len;i++) {
|
||||
if (ast_test_flag(flags, options[i].flag)) {
|
||||
buf[found++] = i;
|
||||
}
|
||||
}
|
||||
buf[found] = '\0';
|
||||
}
|
||||
|
||||
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
|
||||
{
|
||||
char *s;
|
||||
|
@@ -35,8 +35,9 @@ static void dialed_interface_destroy(void *data)
|
||||
struct ast_dialed_interface *di = NULL;
|
||||
AST_LIST_HEAD(, ast_dialed_interface) *dialed_interface_list = data;
|
||||
|
||||
if (!dialed_interface_list)
|
||||
if (!dialed_interface_list) {
|
||||
return;
|
||||
}
|
||||
|
||||
AST_LIST_LOCK(dialed_interface_list);
|
||||
while ((di = AST_LIST_REMOVE_HEAD(dialed_interface_list, list)))
|
||||
@@ -53,11 +54,13 @@ static void *dialed_interface_duplicate(void *data)
|
||||
AST_LIST_HEAD(, ast_dialed_interface) *old_list;
|
||||
AST_LIST_HEAD(, ast_dialed_interface) *new_list = NULL;
|
||||
|
||||
if(!(old_list = data))
|
||||
if(!(old_list = data)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!(new_list = ast_calloc(1, sizeof(*new_list))))
|
||||
if(!(new_list = ast_calloc(1, sizeof(*new_list)))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AST_LIST_HEAD_INIT(new_list);
|
||||
AST_LIST_LOCK(old_list);
|
||||
@@ -76,8 +79,35 @@ static void *dialed_interface_duplicate(void *data)
|
||||
return new_list;
|
||||
}
|
||||
|
||||
|
||||
static void *dial_features_duplicate(void *data)
|
||||
{
|
||||
struct ast_dial_features *df = data, *df_copy;
|
||||
|
||||
if (!(df_copy = ast_calloc(1, sizeof(*df)))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(df_copy, df, sizeof(*df));
|
||||
|
||||
return df_copy;
|
||||
}
|
||||
|
||||
static void dial_features_destroy(void *data) {
|
||||
struct ast_dial_features *df = data;
|
||||
if (df) {
|
||||
ast_free(df);
|
||||
}
|
||||
}
|
||||
|
||||
const struct ast_datastore_info dialed_interface_info = {
|
||||
.type ="dialed-interface",
|
||||
.type = "dialed-interface",
|
||||
.destroy = dialed_interface_destroy,
|
||||
.duplicate = dialed_interface_duplicate,
|
||||
};
|
||||
|
||||
const struct ast_datastore_info dial_features_info = {
|
||||
.type = "dial-features",
|
||||
.destroy = dial_features_destroy,
|
||||
.duplicate = dial_features_duplicate,
|
||||
};
|
||||
|
Reference in New Issue
Block a user