From 0891b8a53c15aa09b50404299c22413cbf586943 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Tue, 5 Aug 2008 16:56:11 +0000 Subject: make datastore creation and destruction a generic API since it is not really channel related, and add the ability to add/find/remove datastores to manager sessions git-svn-id: http://svn.digium.com/svn/asterisk/trunk@135680 f38db490-d61c-443f-a65b-d21fe96a405b --- funcs/func_enum.c | 2 +- funcs/func_global.c | 4 ++-- funcs/func_lock.c | 4 ++-- funcs/func_odbc.c | 6 +++--- funcs/func_speex.c | 8 ++++---- funcs/func_volume.c | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) (limited to 'funcs') diff --git a/funcs/func_enum.c b/funcs/func_enum.c index 0fba5af3b..54893a9bf 100644 --- a/funcs/func_enum.c +++ b/funcs/func_enum.c @@ -189,7 +189,7 @@ static int enum_query_read(struct ast_channel *chan, const char *cmd, char *data snprintf(buf, len, "%u", erds->id); - if (!(datastore = ast_channel_datastore_alloc(&enum_result_datastore_info, buf))) { + if (!(datastore = ast_datastore_alloc(&enum_result_datastore_info, buf))) { ast_free(erds->context); ast_free(erds); goto finish; diff --git a/funcs/func_global.c b/funcs/func_global.c index d97379ce9..3380cef12 100644 --- a/funcs/func_global.c +++ b/funcs/func_global.c @@ -158,7 +158,7 @@ static int shared_write(struct ast_channel *chan, const char *cmd, char *data, c ast_channel_lock(chan); if (!(varstore = ast_channel_datastore_find(chan, &shared_variable_info, NULL))) { - if (!(varstore = ast_channel_datastore_alloc(&shared_variable_info, NULL))) { + if (!(varstore = ast_datastore_alloc(&shared_variable_info, NULL))) { ast_log(LOG_ERROR, "Unable to allocate new datastore. Shared variable not set.\n"); ast_channel_unlock(chan); return -1; @@ -166,7 +166,7 @@ static int shared_write(struct ast_channel *chan, const char *cmd, char *data, c if (!(varshead = ast_calloc(1, sizeof(*varshead)))) { ast_log(LOG_ERROR, "Unable to allocate variable structure. Shared variable not set.\n"); - ast_channel_datastore_free(varstore); + ast_datastore_free(varstore); ast_channel_unlock(chan); return -1; } diff --git a/funcs/func_lock.c b/funcs/func_lock.c index 53b05a3e8..133ea3e22 100644 --- a/funcs/func_lock.c +++ b/funcs/func_lock.c @@ -96,7 +96,7 @@ static int get_lock(struct ast_channel *chan, char *lockname, int try) if (!lock_store) { ast_debug(1, "Channel %s has no lock datastore, so we're allocating one.\n", chan->name); - lock_store = ast_channel_datastore_alloc(&lock_info, NULL); + lock_store = ast_datastore_alloc(&lock_info, NULL); if (!lock_store) { ast_log(LOG_ERROR, "Unable to allocate new datastore. No locks will be obtained.\n"); return -1; @@ -105,7 +105,7 @@ static int get_lock(struct ast_channel *chan, char *lockname, int try) list = ast_calloc(1, sizeof(*list)); if (!list) { ast_log(LOG_ERROR, "Unable to allocate datastore list head. %sLOCK will fail.\n", try ? "TRY" : ""); - ast_channel_datastore_free(lock_store); + ast_datastore_free(lock_store); return -1; } diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c index 13701873f..6ac47bdcb 100644 --- a/funcs/func_odbc.c +++ b/funcs/func_odbc.c @@ -480,7 +480,7 @@ end_acf_read: struct ast_datastore *odbc_store; uid = ast_atomic_fetchadd_int(&resultcount, +1) + 1; snprintf(buf, len, "%d", uid); - odbc_store = ast_channel_datastore_alloc(&odbc_info, buf); + odbc_store = ast_datastore_alloc(&odbc_info, buf); if (!odbc_store) { ast_log(LOG_ERROR, "Rows retrieved, but unable to store it in the channel. Results fail.\n"); odbc_datastore_free(resultset); @@ -550,7 +550,7 @@ static int acf_fetch(struct ast_channel *chan, const char *cmd, char *data, char if (!row) { /* Cleanup datastore */ ast_channel_datastore_remove(chan, store); - ast_channel_datastore_free(store); + ast_datastore_free(store); return -1; } pbx_builtin_setvar_helper(chan, "~ODBCFIELDS~", resultset->names); @@ -584,7 +584,7 @@ static int exec_odbcfinish(struct ast_channel *chan, void *data) if (!store) /* Already freed; no big deal. */ return 0; ast_channel_datastore_remove(chan, store); - ast_channel_datastore_free(store); + ast_datastore_free(store); return 0; } diff --git a/funcs/func_speex.c b/funcs/func_speex.c index 7b2484010..4ddfab80b 100644 --- a/funcs/func_speex.c +++ b/funcs/func_speex.c @@ -151,12 +151,12 @@ static int speex_write(struct ast_channel *chan, const char *cmd, char *data, co if (!(datastore = ast_channel_datastore_find(chan, &speex_datastore, NULL))) { ast_channel_unlock(chan); - if (!(datastore = ast_channel_datastore_alloc(&speex_datastore, NULL))) { + if (!(datastore = ast_datastore_alloc(&speex_datastore, NULL))) { return 0; } if (!(si = ast_calloc(1, sizeof(*si)))) { - ast_channel_datastore_free(datastore); + ast_datastore_free(datastore); return 0; } @@ -177,7 +177,7 @@ static int speex_write(struct ast_channel *chan, const char *cmd, char *data, co ast_log(LOG_ERROR, "Invalid argument provided to the %s function\n", cmd); if (is_new) { - ast_channel_datastore_free(datastore); + ast_datastore_free(datastore); return -1; } } @@ -237,7 +237,7 @@ static int speex_write(struct ast_channel *chan, const char *cmd, char *data, co ast_audiohook_detach(&si->audiohook); } - ast_channel_datastore_free(datastore); + ast_datastore_free(datastore); } if (is_new) { diff --git a/funcs/func_volume.c b/funcs/func_volume.c index 9a5247f54..530f9b876 100644 --- a/funcs/func_volume.c +++ b/funcs/func_volume.c @@ -106,10 +106,10 @@ static int volume_write(struct ast_channel *chan, const char *cmd, char *data, c if (!(datastore = ast_channel_datastore_find(chan, &volume_datastore, NULL))) { /* Allocate a new datastore to hold the reference to this volume and audiohook information */ - if (!(datastore = ast_channel_datastore_alloc(&volume_datastore, NULL))) + if (!(datastore = ast_datastore_alloc(&volume_datastore, NULL))) return 0; if (!(vi = ast_calloc(1, sizeof(*vi)))) { - ast_channel_datastore_free(datastore); + ast_datastore_free(datastore); return 0; } ast_audiohook_init(&vi->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "Volume"); -- cgit v1.2.3