Add attributes to various API calls, to help track down bugs (and remove a deprecated function)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115157 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
927870cd7d
commit
748f3cf456
|
@ -1621,6 +1621,59 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox
|
|||
return;
|
||||
}
|
||||
|
||||
struct insert_data {
|
||||
char *sql;
|
||||
char *dir;
|
||||
char *msgnums;
|
||||
void *data;
|
||||
SQLLEN datalen;
|
||||
const char *context;
|
||||
const char *macrocontext;
|
||||
const char *callerid;
|
||||
const char *origtime;
|
||||
const char *duration;
|
||||
char *mailboxuser;
|
||||
char *mailboxcontext;
|
||||
const char *category;
|
||||
};
|
||||
|
||||
static SQLHSTMT insert_data_cb(struct odbc_obj *obj, void *vdata)
|
||||
{
|
||||
struct insert_data *data = vdata;
|
||||
int res;
|
||||
SQLHSTMT stmt;
|
||||
SQLLEN len = data->datalen;
|
||||
|
||||
res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
|
||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||
ast_log(AST_LOG_WARNING, "SQL Alloc Handle failed!\n");
|
||||
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->dir), 0, (void *)data->dir, 0, NULL);
|
||||
SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->msgnums), 0, (void *)data->msgnums, 0, NULL);
|
||||
SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, data->datalen, 0, (void *)data->data, data->datalen, &len);
|
||||
SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->context), 0, (void *)data->context, 0, NULL);
|
||||
SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->macrocontext), 0, (void *)data->macrocontext, 0, NULL);
|
||||
SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->callerid), 0, (void *)data->callerid, 0, NULL);
|
||||
SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->origtime), 0, (void *)data->origtime, 0, NULL);
|
||||
SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->duration), 0, (void *)data->duration, 0, NULL);
|
||||
SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxuser), 0, (void *)data->mailboxuser, 0, NULL);
|
||||
SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxcontext), 0, (void *)data->mailboxcontext, 0, NULL);
|
||||
if (!ast_strlen_zero(data->category)) {
|
||||
SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->category), 0, (void *)data->category, 0, NULL);
|
||||
}
|
||||
res = SQLExecDirect(stmt, (unsigned char *)data->sql, SQL_NTS);
|
||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||
ast_log(AST_LOG_WARNING, "SQL Direct Execute failed!\n");
|
||||
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return stmt;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Stores a voicemail into the database.
|
||||
* \param dir the folder the mailbox folder to store the message.
|
||||
|
@ -1636,32 +1689,29 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox
|
|||
*/
|
||||
static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int msgnum)
|
||||
{
|
||||
int x = 0;
|
||||
int res;
|
||||
int res = 0;
|
||||
int fd = -1;
|
||||
void *fdm = MAP_FAILED;
|
||||
size_t fdlen = -1;
|
||||
SQLHSTMT stmt;
|
||||
SQLLEN len;
|
||||
char sql[PATH_MAX];
|
||||
char msgnums[20];
|
||||
char fn[PATH_MAX];
|
||||
char full_fn[PATH_MAX];
|
||||
char fmt[80] = "";
|
||||
char *c;
|
||||
const char *context = "";
|
||||
const char *macrocontext = "";
|
||||
const char *callerid = "";
|
||||
const char *origtime = "";
|
||||
const char *duration = "";
|
||||
const char *category = "";
|
||||
struct ast_config *cfg = NULL;
|
||||
struct odbc_obj *obj;
|
||||
struct insert_data idata = { .sql = sql, .msgnums = msgnums, .dir = dir, .mailboxuser = mailboxuser, .mailboxcontext = mailboxcontext };
|
||||
struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
|
||||
|
||||
delete_file(dir, msgnum);
|
||||
obj = ast_odbc_request_obj(odbc_database, 0);
|
||||
if (obj) {
|
||||
if (!(obj = ast_odbc_request_obj(odbc_database, 0))) {
|
||||
ast_log(AST_LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
|
||||
return -1;
|
||||
}
|
||||
|
||||
do {
|
||||
ast_copy_string(fmt, vmfmts, sizeof(fmt));
|
||||
c = strchr(fmt, '|');
|
||||
if (c)
|
||||
|
@ -1679,22 +1729,28 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
|
|||
fd = open(full_fn, O_RDWR);
|
||||
if (fd < 0) {
|
||||
ast_log(AST_LOG_WARNING, "Open of sound file '%s' failed: %s\n", full_fn, strerror(errno));
|
||||
ast_odbc_release_obj(obj);
|
||||
goto yuck;
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
if (cfg) {
|
||||
context = ast_variable_retrieve(cfg, "message", "context");
|
||||
if (!context) context = "";
|
||||
macrocontext = ast_variable_retrieve(cfg, "message", "macrocontext");
|
||||
if (!macrocontext) macrocontext = "";
|
||||
callerid = ast_variable_retrieve(cfg, "message", "callerid");
|
||||
if (!callerid) callerid = "";
|
||||
origtime = ast_variable_retrieve(cfg, "message", "origtime");
|
||||
if (!origtime) origtime = "";
|
||||
duration = ast_variable_retrieve(cfg, "message", "duration");
|
||||
if (!duration) duration = "";
|
||||
category = ast_variable_retrieve(cfg, "message", "category");
|
||||
if (!category) category = "";
|
||||
if (!(idata.context = ast_variable_retrieve(cfg, "message", "context"))) {
|
||||
idata.context = "";
|
||||
}
|
||||
if (!(idata.macrocontext = ast_variable_retrieve(cfg, "message", "macrocontext"))) {
|
||||
idata.macrocontext = "";
|
||||
}
|
||||
if (!(idata.callerid = ast_variable_retrieve(cfg, "message", "callerid"))) {
|
||||
idata.callerid = "";
|
||||
}
|
||||
if (!(idata.origtime = ast_variable_retrieve(cfg, "message", "origtime"))) {
|
||||
idata.origtime = "";
|
||||
}
|
||||
if (!(idata.duration = ast_variable_retrieve(cfg, "message", "duration"))) {
|
||||
idata.duration = "";
|
||||
}
|
||||
if (!(idata.category = ast_variable_retrieve(cfg, "message", "category"))) {
|
||||
idata.category = "";
|
||||
}
|
||||
}
|
||||
fdlen = lseek(fd, 0, SEEK_END);
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
|
@ -1702,58 +1758,34 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
|
|||
fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (fdm == MAP_FAILED) {
|
||||
ast_log(AST_LOG_WARNING, "Memory map failed!\n");
|
||||
ast_odbc_release_obj(obj);
|
||||
goto yuck;
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
|
||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||
ast_log(AST_LOG_WARNING, "SQL Alloc Handle failed!\n");
|
||||
ast_odbc_release_obj(obj);
|
||||
goto yuck;
|
||||
}
|
||||
if (!ast_strlen_zero(category))
|
||||
idata.data = fdm;
|
||||
idata.datalen = fdlen;
|
||||
|
||||
if (!ast_strlen_zero(idata.category))
|
||||
snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?)", odbc_table);
|
||||
else
|
||||
snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)", odbc_table);
|
||||
res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
|
||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||
ast_log(AST_LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
|
||||
|
||||
if ((stmt = ast_odbc_direct_execute(obj, insert_data_cb, &idata))) {
|
||||
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
|
||||
ast_odbc_release_obj(obj);
|
||||
goto yuck;
|
||||
}
|
||||
len = fdlen; /* SQL_LEN_DATA_AT_EXEC(fdlen); */
|
||||
SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(dir), 0, (void *)dir, 0, NULL);
|
||||
SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL);
|
||||
SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, fdlen, 0, (void *)fdm, fdlen, &len);
|
||||
SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(context), 0, (void *)context, 0, NULL);
|
||||
SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(macrocontext), 0, (void *)macrocontext, 0, NULL);
|
||||
SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(callerid), 0, (void *)callerid, 0, NULL);
|
||||
SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(origtime), 0, (void *)origtime, 0, NULL);
|
||||
SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(duration), 0, (void *)duration, 0, NULL);
|
||||
SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(mailboxuser), 0, (void *)mailboxuser, 0, NULL);
|
||||
SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(mailboxcontext), 0, (void *)mailboxcontext, 0, NULL);
|
||||
if (!ast_strlen_zero(category))
|
||||
SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(category), 0, (void *)category, 0, NULL);
|
||||
res = ast_odbc_smart_execute(obj, stmt);
|
||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||
} else {
|
||||
ast_log(AST_LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
|
||||
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
|
||||
ast_odbc_release_obj(obj);
|
||||
goto yuck;
|
||||
res = -1;
|
||||
}
|
||||
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
|
||||
} while (0);
|
||||
if (obj) {
|
||||
ast_odbc_release_obj(obj);
|
||||
} else
|
||||
ast_log(AST_LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
|
||||
yuck:
|
||||
}
|
||||
if (cfg)
|
||||
ast_config_destroy(cfg);
|
||||
if (fdm != MAP_FAILED)
|
||||
munmap(fdm, fdlen);
|
||||
if (fd > -1)
|
||||
close(fd);
|
||||
return x;
|
||||
return res;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -4607,7 +4607,7 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist)
|
|||
/* Destroy Session-Timers if allocated */
|
||||
if (p->stimer) {
|
||||
if (p->stimer->st_active == TRUE && p->stimer->st_schedid > -1)
|
||||
ast_sched_del(sched, p->stimer->st_schedid);
|
||||
AST_SCHED_DEL(sched, p->stimer->st_schedid);
|
||||
ast_free(p->stimer);
|
||||
p->stimer = NULL;
|
||||
}
|
||||
|
@ -15978,7 +15978,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str
|
|||
case 423: /* Interval too brief */
|
||||
r->expiry = atoi(get_header(req, "Min-Expires"));
|
||||
ast_log(LOG_WARNING, "Got 423 Interval too brief for service %s@%s, minimum is %d seconds\n", p->registry->username, p->registry->hostname, r->expiry);
|
||||
ast_sched_del(sched, r->timeout);
|
||||
AST_SCHED_DEL(sched, r->timeout);
|
||||
r->timeout = -1;
|
||||
if (r->call) {
|
||||
r->call = dialog_unref(r->call, "unsetting registry->call pointer-- case 423");
|
||||
|
|
|
@ -182,8 +182,8 @@ int ast_category_exist(const struct ast_config *config, const char *category_nam
|
|||
* that unlike the variables in ast_config, the resulting list of variables
|
||||
* MUST be freed with ast_variables_destroy() as there is no container.
|
||||
*/
|
||||
struct ast_variable *ast_load_realtime(const char *family, ...);
|
||||
struct ast_variable *ast_load_realtime_all(const char *family, ...);
|
||||
struct ast_variable *ast_load_realtime(const char *family, ...) __attribute__((sentinel));
|
||||
struct ast_variable *ast_load_realtime_all(const char *family, ...) __attribute__((sentinel));
|
||||
|
||||
/*!
|
||||
* \brief Retrieve realtime configuration
|
||||
|
@ -194,7 +194,7 @@ struct ast_variable *ast_load_realtime_all(const char *family, ...);
|
|||
* is thus stored inside a taditional ast_config structure rather than
|
||||
* just returning a linked list of variables.
|
||||
*/
|
||||
struct ast_config *ast_load_realtime_multientry(const char *family, ...);
|
||||
struct ast_config *ast_load_realtime_multientry(const char *family, ...) __attribute__((sentinel));
|
||||
|
||||
/*!
|
||||
* \brief Update realtime configuration
|
||||
|
@ -204,7 +204,7 @@ struct ast_config *ast_load_realtime_multientry(const char *family, ...);
|
|||
* This function is used to update a parameter in realtime configuration space.
|
||||
*
|
||||
*/
|
||||
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup, ...);
|
||||
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup, ...) __attribute__((sentinel));
|
||||
|
||||
/*!
|
||||
* \brief Create realtime configuration
|
||||
|
@ -212,7 +212,7 @@ int ast_update_realtime(const char *family, const char *keyfield, const char *lo
|
|||
* This function is used to create a parameter in realtime configuration space.
|
||||
*
|
||||
*/
|
||||
int ast_store_realtime(const char *family, ...);
|
||||
int ast_store_realtime(const char *family, ...) __attribute__((sentinel));
|
||||
|
||||
/*!
|
||||
* \brief Destroy realtime configuration
|
||||
|
@ -223,7 +223,7 @@ int ast_store_realtime(const char *family, ...);
|
|||
* Additional params are used as keys.
|
||||
*
|
||||
*/
|
||||
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup, ...);
|
||||
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup, ...) __attribute__((sentinel));
|
||||
|
||||
/*!
|
||||
* \brief Check if realtime engine is configured for family
|
||||
|
|
|
@ -81,8 +81,8 @@ void ast_verbose(const char *fmt, ...)
|
|||
void ast_child_verbose(int level, const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
int ast_register_verbose(void (*verboser)(const char *string));
|
||||
int ast_unregister_verbose(void (*verboser)(const char *string));
|
||||
int ast_register_verbose(void (*verboser)(const char *string)) __attribute__((warn_unused_result));
|
||||
int ast_unregister_verbose(void (*verboser)(const char *string)) __attribute__((warn_unused_result));
|
||||
|
||||
void ast_console_puts(const char *string);
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ char *ast_sched_report(struct sched_context *con, char *buf, int bufsiz, struct
|
|||
* \param data data to pass to the callback
|
||||
* \return Returns a schedule item ID on success, -1 on failure
|
||||
*/
|
||||
int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data);
|
||||
int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data) __attribute__((warn_unused_result));
|
||||
|
||||
/*!
|
||||
* \brief replace a scheduler entry
|
||||
|
@ -168,7 +168,7 @@ int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, co
|
|||
* \retval -1 failure
|
||||
* \retval otherwise, returns scheduled item ID
|
||||
*/
|
||||
int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data);
|
||||
int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data) __attribute__((warn_unused_result));
|
||||
|
||||
/*!Adds a scheduled event with rescheduling support
|
||||
* \param con Scheduler context to add
|
||||
|
@ -183,7 +183,7 @@ int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched
|
|||
* If callback returns 0, no further events will be re-scheduled
|
||||
* \return Returns a schedule item ID on success, -1 on failure
|
||||
*/
|
||||
int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable);
|
||||
int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable) __attribute__((warn_unused_result));
|
||||
|
||||
/*!
|
||||
* \brief replace a scheduler entry
|
||||
|
@ -196,7 +196,7 @@ int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb cal
|
|||
* \retval -1 failure
|
||||
* \retval otherwise, returns scheduled item ID
|
||||
*/
|
||||
int ast_sched_replace_variable(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable);
|
||||
int ast_sched_replace_variable(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable) __attribute__((warn_unused_result));
|
||||
|
||||
|
||||
/*! \brief Find a sched structure and return the data field associated with it.
|
||||
|
@ -216,8 +216,7 @@ const void *ast_sched_find_data(struct sched_context *con, int id);
|
|||
* \param id ID of the scheduled item to delete
|
||||
* \return Returns 0 on success, -1 on failure
|
||||
*/
|
||||
|
||||
int ast_sched_del(struct sched_context *con, int id);
|
||||
int ast_sched_del(struct sched_context *con, int id) __attribute__((warn_unused_result));
|
||||
|
||||
/*! \brief Determines number of seconds until the next outstanding event to take place
|
||||
* Determine the number of seconds until the next outstanding event
|
||||
|
@ -228,7 +227,7 @@ int ast_sched_del(struct sched_context *con, int id);
|
|||
* \return Returns "-1" if there is nothing there are no scheduled events
|
||||
* (and thus the poll should not timeout)
|
||||
*/
|
||||
int ast_sched_wait(struct sched_context *con);
|
||||
int ast_sched_wait(struct sched_context *con) __attribute__((warn_unused_result));
|
||||
|
||||
/*! \brief Runs the queue
|
||||
* \param con Scheduling context to run
|
||||
|
|
|
@ -1117,7 +1117,10 @@ static int ast_makesocket(void)
|
|||
ast_socket = -1;
|
||||
return -1;
|
||||
}
|
||||
ast_register_verbose(network_verboser);
|
||||
if (ast_register_verbose(network_verboser)) {
|
||||
ast_log(LOG_WARNING, "Unable to register network verboser?\n");
|
||||
}
|
||||
|
||||
ast_pthread_create_background(<hread, NULL, listener, NULL);
|
||||
|
||||
if (!ast_strlen_zero(ast_config_AST_CTL_OWNER)) {
|
||||
|
@ -2914,7 +2917,9 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
if (ast_opt_console || option_verbose || (ast_opt_remote && !ast_opt_exec)) {
|
||||
ast_register_verbose(console_verboser);
|
||||
if (ast_register_verbose(console_verboser)) {
|
||||
ast_log(LOG_WARNING, "Unable to register console verboser?\n");
|
||||
}
|
||||
WELCOME_MESSAGE;
|
||||
}
|
||||
|
||||
|
|
|
@ -2130,7 +2130,8 @@ int ast_update_realtime(const char *family, const char *keyfield, const char *lo
|
|||
return res;
|
||||
}
|
||||
|
||||
int ast_store_realtime(const char *family, ...) {
|
||||
int ast_store_realtime(const char *family, ...)
|
||||
{
|
||||
struct ast_config_engine *eng;
|
||||
int res = -1;
|
||||
char db[256]="";
|
||||
|
@ -2146,7 +2147,8 @@ int ast_store_realtime(const char *family, ...) {
|
|||
return res;
|
||||
}
|
||||
|
||||
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup, ...) {
|
||||
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup, ...)
|
||||
{
|
||||
struct ast_config_engine *eng;
|
||||
int res = -1;
|
||||
char db[256]="";
|
||||
|
|
10
main/sched.c
10
main/sched.c
|
@ -252,8 +252,9 @@ static int sched_settime(struct timeval *tv, int when)
|
|||
int ast_sched_replace_variable(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable)
|
||||
{
|
||||
/* 0 means the schedule item is new; do not delete */
|
||||
if (old_id > 0)
|
||||
ast_sched_del(con, old_id);
|
||||
if (old_id > 0) {
|
||||
AST_SCHED_DEL(con, old_id);
|
||||
}
|
||||
return ast_sched_add_variable(con, when, callback, data, variable);
|
||||
}
|
||||
|
||||
|
@ -295,8 +296,9 @@ int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb cal
|
|||
|
||||
int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data)
|
||||
{
|
||||
if (old_id > -1)
|
||||
ast_sched_del(con, old_id);
|
||||
if (old_id > -1) {
|
||||
AST_SCHED_DEL(con, old_id);
|
||||
}
|
||||
return ast_sched_add(con, when, callback, data);
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue