#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/datastore.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Functions | |
ast_datastore * | ast_datastore_alloc (const struct ast_datastore_info *info, const char *uid) |
Create a data store object. | |
int | ast_datastore_free (struct ast_datastore *datastore) |
Free a data store object. |
Definition in file datastore.c.
struct ast_datastore* ast_datastore_alloc | ( | const struct ast_datastore_info * | info, | |
const char * | uid | |||
) |
Create a data store object.
[in] | info | information describing the data store object |
[in] | uid | unique identifer |
Definition at line 31 of file datastore.c.
References ast_calloc, ast_strdup, and ast_datastore::info.
Referenced by _macro_exec(), acf_iaxvar_write(), add_features_datastores(), add_to_agi(), ast_channel_datastore_alloc(), ast_channel_datastore_inherit(), ast_iax2_new(), audiohook_volume_get(), authenticate_reply(), dial_exec_full(), dundi_query_read(), enable_jack_hook(), enum_query_read(), get_lock(), gosub_exec(), lua_get_state(), pbx_builtin_raise_exception(), setup_chanspy_ds(), setup_inheritance_datastore(), setup_mixmonitor_ds(), setup_transfer_datastore(), shared_write(), smdi_msg_retrieve_read(), socket_process(), speech_create(), speex_write(), try_calling(), and volume_write().
00032 { 00033 struct ast_datastore *datastore = NULL; 00034 00035 /* Make sure we at least have type so we can identify this */ 00036 if (!info) { 00037 return NULL; 00038 } 00039 00040 /* Allocate memory for datastore and clear it */ 00041 datastore = ast_calloc(1, sizeof(*datastore)); 00042 if (!datastore) { 00043 return NULL; 00044 } 00045 00046 datastore->info = info; 00047 00048 datastore->uid = ast_strdup(uid); 00049 00050 return datastore; 00051 }
int ast_datastore_free | ( | struct ast_datastore * | datastore | ) |
Free a data store object.
[in] | datastore | datastore to free |
Definition at line 53 of file datastore.c.
References ast_free, ast_datastore::data, ast_datastore_info::destroy, ast_datastore::info, and ast_datastore::uid.
Referenced by acf_fetch(), add_features_datastores(), add_to_agi(), ast_channel_datastore_free(), ast_channel_free(), ast_iax2_new(), audiohook_volume_get(), authenticate_reply(), chanspy_ds_free(), dial_exec_full(), disable_jack_hook(), exec_odbcfinish(), free_session(), get_lock(), gosub_exec(), lua_get_state(), pbx_builtin_raise_exception(), setup_inheritance_datastore(), shared_write(), socket_process(), speex_write(), try_calling(), and volume_write().
00054 { 00055 int res = 0; 00056 00057 /* Using the destroy function (if present) destroy the data */ 00058 if (datastore->info->destroy != NULL && datastore->data != NULL) { 00059 datastore->info->destroy(datastore->data); 00060 datastore->data = NULL; 00061 } 00062 00063 /* Free allocated UID memory */ 00064 if (datastore->uid != NULL) { 00065 ast_free((void *) datastore->uid); 00066 datastore->uid = NULL; 00067 } 00068 00069 /* Finally free memory used by ourselves */ 00070 ast_free(datastore); 00071 00072 return res; 00073 }