Asterisk datastore objects. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/datastore.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Functions | |
struct ast_datastore * | __ast_datastore_alloc (const struct ast_datastore_info *info, const char *uid, const char *file, int line, const char *function) |
Create a data store object. | |
struct ast_datastore * | ast_datastore_alloc (const struct ast_datastore_info *info, const char *uid) |
int | ast_datastore_free (struct ast_datastore *datastore) |
Free a data store object. |
Asterisk datastore objects.
Definition in file datastore.c.
struct ast_datastore* __ast_datastore_alloc | ( | const struct ast_datastore_info * | info, |
const char * | uid, | ||
const char * | file, | ||
int | line, | ||
const char * | function | ||
) | [read] |
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_calloc, ast_free, ast_strdup, ast_strlen_zero(), ast_datastore::info, and ast_datastore::uid.
Referenced by ast_datastore_alloc().
{ struct ast_datastore *datastore = NULL; /* Make sure we at least have type so we can identify this */ if (!info) { return NULL; } #if defined(__AST_DEBUG_MALLOC) if (!(datastore = __ast_calloc(1, sizeof(*datastore), file, line, function))) { return NULL; } #else if (!(datastore = ast_calloc(1, sizeof(*datastore)))) { return NULL; } #endif datastore->info = info; if (!ast_strlen_zero(uid) && !(datastore->uid = ast_strdup(uid))) { ast_free(datastore); datastore = NULL; } return datastore; }
struct ast_datastore * ast_datastore_alloc | ( | const struct ast_datastore_info * | info, |
const char * | uid | ||
) | [read] |
Definition at line 94 of file datastore.c.
References __ast_datastore_alloc().
Referenced by _macro_exec(), acf_curlopt_write(), acf_iaxvar_write(), acf_odbc_read(), add_features_datastores(), add_to_agi(), apply_plc(), 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(), find_transaction(), 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().
{ return __ast_datastore_alloc(info, uid, __FILE__, __LINE__, __FUNCTION__); }
int ast_datastore_free | ( | struct ast_datastore * | datastore | ) |
Free a data store object.
[in] | datastore | datastore to free |
Definition at line 61 of file datastore.c.
References ast_free, ast_datastore::data, ast_datastore_info::destroy, ast_datastore::info, and ast_datastore::uid.
Referenced by acf_curlopt_write(), acf_fetch(), add_features_datastores(), add_to_agi(), adjust_frame_for_plc(), apply_plc(), 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(), find_transaction(), free_session(), get_lock(), gosub_exec(), lua_get_state(), pbx_builtin_raise_exception(), setup_inheritance_datastore(), shared_write(), socket_process(), speex_write(), stop_mixmonitor_exec(), try_calling(), and volume_write().
{ int res = 0; /* Using the destroy function (if present) destroy the data */ if (datastore->info->destroy != NULL && datastore->data != NULL) { datastore->info->destroy(datastore->data); datastore->data = NULL; } /* Free allocated UID memory */ if (datastore->uid != NULL) { ast_free((void *) datastore->uid); datastore->uid = NULL; } /* Finally free memory used by ourselves */ ast_free(datastore); return res; }