From 7df8b8b848b1cd8c218698d0c03ff8d8481a7fcf Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" 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: https://origsvn.digium.com/svn/asterisk/trunk@135680 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_chanspy.c | 4 ++-- apps/app_dial.c | 8 ++++---- apps/app_queue.c | 10 +++++----- apps/app_speech_utils.c | 2 +- apps/app_stack.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'apps') diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 4c5ab3333..b59b03f69 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -560,7 +560,7 @@ static struct chanspy_ds *chanspy_ds_free(struct chanspy_ds *chanspy_ds) /* chanspy_ds->chan is NULL after this call */ chanspy_ds_destroy(datastore->data); datastore->data = NULL; - ast_channel_datastore_free(datastore); + ast_datastore_free(datastore); } ast_channel_unlock(chan); } @@ -576,7 +576,7 @@ static struct chanspy_ds *setup_chanspy_ds(struct ast_channel *chan, struct chan ast_mutex_lock(&chanspy_ds->lock); - if (!(datastore = ast_channel_datastore_alloc(&chanspy_ds_info, chanspy_ds->unique_id))) { + if (!(datastore = ast_datastore_alloc(&chanspy_ds_info, chanspy_ds->unique_id))) { ast_mutex_unlock(&chanspy_ds->lock); chanspy_ds = chanspy_ds_free(chanspy_ds); ast_channel_unlock(chan); diff --git a/apps/app_dial.c b/apps/app_dial.c index 9b5fe44df..07cbf51ee 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1354,7 +1354,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING); /* Create datastore for channel dial features for caller */ - if (!(ds_caller_features = ast_channel_datastore_alloc(&dial_features_info, NULL))) { + if (!(ds_caller_features = ast_datastore_alloc(&dial_features_info, NULL))) { ast_log(LOG_WARNING, "Unable to create channel datastore for dial features. Aborting!\n"); goto out; } @@ -1416,7 +1416,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags if (datastore) dialed_interfaces = datastore->data; else { - if (!(datastore = ast_channel_datastore_alloc(&dialed_interface_info, NULL))) { + if (!(datastore = ast_datastore_alloc(&dialed_interface_info, NULL))) { ast_log(LOG_WARNING, "Unable to create channel datastore for dialed interfaces. Aborting!\n"); ast_free(tmp); goto out; @@ -1522,7 +1522,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags ast_copy_string(tc->exten, chan->exten, sizeof(tc->exten)); /* Save callee features */ - if (!(ds_callee_features = ast_channel_datastore_alloc(&dial_features_info, NULL))) { + if (!(ds_callee_features = ast_datastore_alloc(&dial_features_info, NULL))) { ast_log(LOG_WARNING, "Unable to create channel datastore for dial features. Aborting!\n"); ast_free(tmp); goto out; @@ -1624,7 +1624,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags * datastore again, causing a crash */ if (!ast_channel_datastore_remove(chan, datastore)) - ast_channel_datastore_free(datastore); + ast_datastore_free(datastore); if (!peer) { if (result) { res = result; diff --git a/apps/app_queue.c b/apps/app_queue.c index eb7cf0f78..e32442bca 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3120,7 +3120,7 @@ static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struc } ast_channel_datastore_remove(new_chan, datastore); - ast_channel_datastore_free(datastore); + ast_datastore_free(datastore); } /*! \brief mechanism to tell if a queue caller was atxferred by a queue member. @@ -3147,7 +3147,7 @@ static void setup_transfer_datastore(struct queue_ent *qe, struct member *member } ast_channel_lock(qe->chan); - if (!(ds = ast_channel_datastore_alloc(&queue_transfer_info, NULL))) { + if (!(ds = ast_datastore_alloc(&queue_transfer_info, NULL))) { ast_channel_unlock(qe->chan); ast_log(LOG_WARNING, "Unable to create transfer datastore. queue_log will not show attended transfer\n"); return; @@ -3321,7 +3321,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce goto out; } if (!datastore) { - if (!(datastore = ast_channel_datastore_alloc(&dialed_interface_info, NULL))) { + if (!(datastore = ast_datastore_alloc(&dialed_interface_info, NULL))) { ao2_ref(cur, -1); ao2_unlock(qe->parent); if (use_weight) @@ -3423,7 +3423,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce * datastore again, causing a crash */ if (datastore && !ast_channel_datastore_remove(qe->chan, datastore)) { - ast_channel_datastore_free(datastore); + ast_datastore_free(datastore); } ao2_lock(qe->parent); if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY) { @@ -3845,7 +3845,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce transfer_ds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL); if (transfer_ds) { ast_channel_datastore_remove(qe->chan, transfer_ds); - ast_channel_datastore_free(transfer_ds); + ast_datastore_free(transfer_ds); } ast_channel_unlock(qe->chan); } diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c index 568c01bc3..939a92f58 100644 --- a/apps/app_speech_utils.c +++ b/apps/app_speech_utils.c @@ -364,7 +364,7 @@ static int speech_create(struct ast_channel *chan, void *data) return 0; } - datastore = ast_channel_datastore_alloc(&speech_datastore, NULL); + datastore = ast_datastore_alloc(&speech_datastore, NULL); if (datastore == NULL) { ast_speech_destroy(speech); pbx_builtin_setvar_helper(chan, "ERROR", "1"); diff --git a/apps/app_stack.c b/apps/app_stack.c index 669f7f4e7..4c42a0158 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -242,7 +242,7 @@ static int gosub_exec(struct ast_channel *chan, void *data) if (!stack_store) { ast_debug(1, "Channel %s has no datastore, so we're allocating one.\n", chan->name); - stack_store = ast_channel_datastore_alloc(&stack_info, NULL); + stack_store = ast_datastore_alloc(&stack_info, NULL); if (!stack_store) { ast_log(LOG_ERROR, "Unable to allocate new datastore. Gosub will fail.\n"); return -1; @@ -251,7 +251,7 @@ static int gosub_exec(struct ast_channel *chan, void *data) oldlist = ast_calloc(1, sizeof(*oldlist)); if (!oldlist) { ast_log(LOG_ERROR, "Unable to allocate datastore list head. Gosub will fail.\n"); - ast_channel_datastore_free(stack_store); + ast_datastore_free(stack_store); return -1; } -- cgit v1.2.3