[svn-commits] mmichelson: branch jrothenberger/asterisk-urgent r115201 - in /team/jrothenbe...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri May 2 09:58:39 CDT 2008


Author: mmichelson
Date: Fri May  2 09:58:39 2008
New Revision: 115201

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115201
Log:
resolve and reset


Modified:
    team/jrothenberger/asterisk-urgent/   (props changed)
    team/jrothenberger/asterisk-urgent/apps/app_voicemail.c
    team/jrothenberger/asterisk-urgent/channels/chan_sip.c
    team/jrothenberger/asterisk-urgent/configure
    team/jrothenberger/asterisk-urgent/configure.ac
    team/jrothenberger/asterisk-urgent/include/asterisk/autoconfig.h.in
    team/jrothenberger/asterisk-urgent/include/asterisk/compiler.h
    team/jrothenberger/asterisk-urgent/include/asterisk/config.h
    team/jrothenberger/asterisk-urgent/include/asterisk/logger.h
    team/jrothenberger/asterisk-urgent/include/asterisk/sched.h
    team/jrothenberger/asterisk-urgent/main/asterisk.c
    team/jrothenberger/asterisk-urgent/main/config.c
    team/jrothenberger/asterisk-urgent/main/sched.c
    team/jrothenberger/asterisk-urgent/res/snmp/agent.c

Propchange: team/jrothenberger/asterisk-urgent/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/jrothenberger/asterisk-urgent/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/jrothenberger/asterisk-urgent/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May  2 09:58:39 2008
@@ -1,1 +1,1 @@
-/trunk:1-115127
+/trunk:1-115198

Modified: team/jrothenberger/asterisk-urgent/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/apps/app_voicemail.c?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/apps/app_voicemail.c (original)
+++ team/jrothenberger/asterisk-urgent/apps/app_voicemail.c Fri May  2 09:58:39 2008
@@ -1627,6 +1627,61 @@
 	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;
+	const char *flag;
+};
+
+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);
+	SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->flag), 0, (void *)data->flag, 0, NULL);
+	if (!ast_strlen_zero(data->category)) {
+		SQLBindParameter(stmt, 12, 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.
@@ -1642,33 +1697,29 @@
  */
 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 = "";
-	const char *flag = "";
 	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)
@@ -1686,24 +1737,31 @@
 		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 = "";
-			flag = ast_variable_retrieve(cfg, "message", "flag");
-			if (!flag) flag = "";
+			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 = "";
+			}
+			if (!(idata.flag = ast_variable_retrieve(cfg, "message", "flag"))) {
+				idata.flag = "";
+			}
 		}
 		fdlen = lseek(fd, 0, SEEK_END);
 		lseek(fd, 0, SEEK_SET);
@@ -1711,59 +1769,34 @@
 		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,flag,category) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",odbc_table); 
 		else
 			snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,flag) 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);
-		SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(flag), 0, (void *)flag, 0, NULL);
-		if (!ast_strlen_zero(category))
-			SQLBindParameter(stmt, 12, 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;
-		}
-		SQLFreeHandle (SQL_HANDLE_STMT, stmt);
+			res = -1;
+		}
+	} 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;
 }
 
 /*!

Modified: team/jrothenberger/asterisk-urgent/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/channels/chan_sip.c?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/channels/chan_sip.c (original)
+++ team/jrothenberger/asterisk-urgent/channels/chan_sip.c Fri May  2 09:58:39 2008
@@ -4607,7 +4607,7 @@
 	/* 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 @@
 	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");

Modified: team/jrothenberger/asterisk-urgent/configure.ac
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/configure.ac?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/configure.ac (original)
+++ team/jrothenberger/asterisk-urgent/configure.ac Fri May  2 09:58:39 2008
@@ -437,6 +437,7 @@
 AST_GCC_ATTRIBUTE(unused)
 AST_GCC_ATTRIBUTE(always_inline)
 AST_GCC_ATTRIBUTE(deprecated)
+AST_GCC_ATTRIBUTE(sentinel)
 
 AC_MSG_CHECKING(for -ffunction-sections support)
 saved_CFLAGS="${CFLAGS}"

Modified: team/jrothenberger/asterisk-urgent/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/include/asterisk/autoconfig.h.in?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/include/asterisk/autoconfig.h.in (original)
+++ team/jrothenberger/asterisk-urgent/include/asterisk/autoconfig.h.in Fri May  2 09:58:39 2008
@@ -103,6 +103,9 @@
 
 /* Define to 1 if your GCC C compiler supports the 'pure' attribute. */
 #undef HAVE_ATTRIBUTE_pure
+
+/* Define to 1 if your GCC C compiler supports the 'sentinel' attribute. */
+#undef HAVE_ATTRIBUTE_sentinel
 
 /* Define to 1 if your GCC C compiler supports the 'unused' attribute. */
 #undef HAVE_ATTRIBUTE_unused

Modified: team/jrothenberger/asterisk-urgent/include/asterisk/compiler.h
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/include/asterisk/compiler.h?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/include/asterisk/compiler.h (original)
+++ team/jrothenberger/asterisk-urgent/include/asterisk/compiler.h Fri May  2 09:58:39 2008
@@ -53,4 +53,10 @@
 #define attribute_malloc
 #endif
 
+#if HAVE_ATTRIBUTE_sentinel
+#define attribute_sentinel __attribute__((sentinel))
+#else
+#define attribute_sentinel
+#endif
+
 #endif /* _ASTERISK_COMPILER_H */

Modified: team/jrothenberger/asterisk-urgent/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/include/asterisk/config.h?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/include/asterisk/config.h (original)
+++ team/jrothenberger/asterisk-urgent/include/asterisk/config.h Fri May  2 09:58:39 2008
@@ -182,8 +182,8 @@
  * 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 @@
  * 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 @@
  * 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 @@
  * 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 @@
  * 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 

Modified: team/jrothenberger/asterisk-urgent/include/asterisk/logger.h
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/include/asterisk/logger.h?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/include/asterisk/logger.h (original)
+++ team/jrothenberger/asterisk-urgent/include/asterisk/logger.h Fri May  2 09:58:39 2008
@@ -81,8 +81,8 @@
 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);
 

Modified: team/jrothenberger/asterisk-urgent/include/asterisk/sched.h
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/include/asterisk/sched.h?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/include/asterisk/sched.h (original)
+++ team/jrothenberger/asterisk-urgent/include/asterisk/sched.h Fri May  2 09:58:39 2008
@@ -42,17 +42,11 @@
  * then whatever callback had been running will complete
  * and reinsert the task into the scheduler.
  *
- * Note that this is NOT always appropriate. This should 
- * only be used for tasks whose callback may return non-zero 
- * to indicate that the task needs to be rescheduled with the
- * SAME id as previously.
- *
- * Some scheduler callbacks instead may reschedule the task themselves,
- * thus removing the previous task id from the queue. If the task is rescheduled
- * in this manner, then the id for the task will be different than before
- * and so it makes no sense to use this macro. Note that if using the scheduler
- * in this manner, it is perfectly acceptable for ast_sched_del to fail, and this
- * macro should NOT be used.
+ * Since macro expansion essentially works like pass-by-name
+ * parameter passing, this macro will still work correctly even
+ * if the id of the task to delete changes. This holds as long as 
+ * the name of the id which could change is passed to the macro 
+ * and not a copy of the value of the id.
  */
 #define AST_SCHED_DEL(sched, id) \
 	do { \
@@ -155,7 +149,7 @@
  * \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 +162,7 @@
  * \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 +177,7 @@
  * 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 +190,7 @@
  * \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 +210,7 @@
  * \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 +221,7 @@
  * \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

Modified: team/jrothenberger/asterisk-urgent/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/main/asterisk.c?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/main/asterisk.c (original)
+++ team/jrothenberger/asterisk-urgent/main/asterisk.c Fri May  2 09:58:39 2008
@@ -1117,7 +1117,10 @@
 		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(&lthread, NULL, listener, NULL);
 
 	if (!ast_strlen_zero(ast_config_AST_CTL_OWNER)) {
@@ -2914,7 +2917,9 @@
 	}
 
 	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;
 	}
 

Modified: team/jrothenberger/asterisk-urgent/main/config.c
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/main/config.c?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/main/config.c (original)
+++ team/jrothenberger/asterisk-urgent/main/config.c Fri May  2 09:58:39 2008
@@ -2130,7 +2130,8 @@
 	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 @@
 	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]="";

Modified: team/jrothenberger/asterisk-urgent/main/sched.c
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/main/sched.c?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/main/sched.c (original)
+++ team/jrothenberger/asterisk-urgent/main/sched.c Fri May  2 09:58:39 2008
@@ -252,8 +252,9 @@
 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_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);
 }
 

Modified: team/jrothenberger/asterisk-urgent/res/snmp/agent.c
URL: http://svn.digium.com/view/asterisk/team/jrothenberger/asterisk-urgent/res/snmp/agent.c?view=diff&rev=115201&r1=115200&r2=115201
==============================================================================
--- team/jrothenberger/asterisk-urgent/res/snmp/agent.c (original)
+++ team/jrothenberger/asterisk-urgent/res/snmp/agent.c Fri May  2 09:58:39 2008
@@ -301,9 +301,9 @@
 		}
 		break;
 	case ASTCHANWHENHANGUP:
-		if (chan->whentohangup) {
+		if (!ast_tvzero(chan->whentohangup)) {
 			gettimeofday(&tval, NULL);
-			long_ret = difftime(chan->whentohangup, tval.tv_sec) * 100 - tval.tv_usec / 10000;
+			long_ret = difftime(chan->whentohangup.tv_sec, tval.tv_sec) * 100 - tval.tv_usec / 10000;
 			ret= (u_char *)&long_ret;
 		}
 		break;




More information about the svn-commits mailing list