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
This commit is contained in:
Kevin P. Fleming
2008-08-05 16:56:11 +00:00
parent 8ba981911a
commit 7df8b8b848
25 changed files with 316 additions and 140 deletions

View File

@@ -988,7 +988,7 @@ static lua_State *lua_get_state(struct ast_channel *chan)
if (!datastore) {
/* nothing found, allocate a new lua state */
datastore = ast_channel_datastore_alloc(&lua_datastore, NULL);
datastore = ast_datastore_alloc(&lua_datastore, NULL);
if (!datastore) {
ast_log(LOG_ERROR, "Error allocation channel datastore for lua_State\n");
return NULL;
@@ -996,7 +996,7 @@ static lua_State *lua_get_state(struct ast_channel *chan)
datastore->data = luaL_newstate();
if (!datastore->data) {
ast_channel_datastore_free(datastore);
ast_datastore_free(datastore);
ast_log(LOG_ERROR, "Error allocating lua_State, no memory\n");
return NULL;
}
@@ -1015,7 +1015,7 @@ static lua_State *lua_get_state(struct ast_channel *chan)
ast_channel_datastore_remove(chan, datastore);
ast_channel_unlock(chan);
ast_channel_datastore_free(datastore);
ast_datastore_free(datastore);
return NULL;
}
}