[asterisk-commits] tilghman: branch tilghman/compiler_attributes r111994 - in /team/tilghman/com...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 31 11:29:21 CDT 2008


Author: tilghman
Date: Mon Mar 31 11:29:20 2008
New Revision: 111994

URL: http://svn.digium.com/view/asterisk?view=rev&rev=111994
Log:
Add existing patch

Modified:
    team/tilghman/compiler_attributes/channels/chan_agent.c
    team/tilghman/compiler_attributes/channels/chan_iax2.c
    team/tilghman/compiler_attributes/channels/chan_sip.c
    team/tilghman/compiler_attributes/include/asterisk/config.h
    team/tilghman/compiler_attributes/include/asterisk/devicestate.h
    team/tilghman/compiler_attributes/include/asterisk/logger.h
    team/tilghman/compiler_attributes/include/asterisk/sched.h
    team/tilghman/compiler_attributes/main/config.c

Modified: team/tilghman/compiler_attributes/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/channels/chan_agent.c?view=diff&rev=111994&r1=111993&r2=111994
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_agent.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_agent.c Mon Mar 31 11:29:20 2008
@@ -814,7 +814,7 @@
 		if (persistent_agents)
 			dump_agents();
 	} else {
-		ast_device_state_changed("Agent/%s", p->agent);
+		ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
 	}
 
 	if (p->pending) {
@@ -1499,7 +1499,7 @@
 	set_agentbycallerid(p->logincallerid, NULL);
 	p->loginchan[0] ='\0';
 	p->logincallerid[0] = '\0';
-	ast_device_state_changed("Agent/%s", p->agent);
+	ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
 	if (persistent_agents)
 		dump_agents();	
 
@@ -1988,7 +1988,7 @@
 							check_availability(p, 0);
 						ast_mutex_unlock(&p->lock);
 						AST_LIST_UNLOCK(&agents);
-						ast_device_state_changed("Agent/%s", p->agent);
+						ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
 						while (res >= 0) {
 							ast_mutex_lock(&p->lock);
 							if (p->deferlogoff && p->chan) {
@@ -2009,7 +2009,7 @@
 								if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0) {
 									ast_debug(1, "Wrapup time for %s expired!\n", p->agent);
 									p->lastdisc = ast_tv(0, 0);
-									ast_device_state_changed("Agent/%s", p->agent);
+									ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
 									if (p->ackcall > 1)
 										check_beep(p, 0);
 									else
@@ -2056,7 +2056,7 @@
 						ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGOFF", "%s|%ld", chan->name, logintime);
 						ast_verb(2, "Agent '%s' logged out\n", p->agent);
 						/* If there is no owner, go ahead and kill it now */
-						ast_device_state_changed("Agent/%s", p->agent);
+						ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
 						if (p->dead && !p->owner) {
 							ast_mutex_destroy(&p->lock);
 							ast_mutex_destroy(&p->app_lock);
@@ -2218,7 +2218,7 @@
 				cur_agent->logincallerid[0] = '\0';
 			if (cur_agent->loginstart == 0)
 				time(&cur_agent->loginstart);
-			ast_device_state_changed("Agent/%s", cur_agent->agent);	
+			ast_devstate_changed(AST_DEVICE_UNKNOWN, "Agent/%s", cur_agent->agent);	
 		}
 	}
 	AST_LIST_UNLOCK(&agents);

Modified: team/tilghman/compiler_attributes/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/channels/chan_iax2.c?view=diff&rev=111994&r1=111993&r2=111994
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_iax2.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_iax2.c Mon Mar 31 11:29:20 2008
@@ -6041,7 +6041,7 @@
 	if (expire && (expire < iaxs[callno]->expiry)) 
 		iaxs[callno]->expiry = expire;
 
-	ast_device_state_changed("IAX2/%s", p->name); /* Activate notification */
+	ast_devstate_changed(AST_DEVICE_NOT_INUSE, "IAX2/%s", p->name); /* Activate notification */
 
 	res = 0;
 
@@ -6543,7 +6543,7 @@
 	if (!ast_test_flag(peer, IAX_TEMPONLY))
 		ast_db_del("IAX/Registry", peer->name);
 	register_peer_exten(peer, 0);
-	ast_device_state_changed("IAX2/%s", peer->name); /* Activate notification */
+	ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "IAX2/%s", peer->name); /* Activate notification */
 	if (iax2_regfunk)
 		iax2_regfunk(peer->name, 0);
 
@@ -6591,9 +6591,10 @@
  						if (!ast_sched_del(sched, p->expire)) {
  							p->expire = -1;
  							peer_unref(p);
+							/* XXX Should we exit here? XXX */
  						}
  					}
-  					ast_device_state_changed("IAX2/%s", p->name); /* Activate notification */
+  					ast_devstate_changed(AST_DEVICE_NOT_INUSE, "IAX2/%s", p->name); /* Activate notification */
  					p->expire = iax2_sched_add(sched, (p->expiry + 10) * 1000, expire_registry, peer_ref(p));
  					if (p->expire == -1)
  						peer_unref(p);
@@ -6660,14 +6661,14 @@
 					    ast_test_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED) ? "AUTHENTICATED" : "UNAUTHENTICATED", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
 			manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Registered\r\n", p->name);
 			register_peer_exten(p, 1);
-			ast_device_state_changed("IAX2/%s", p->name); /* Activate notification */
+			ast_devstate_changed(AST_DEVICE_NOT_INUSE, "IAX2/%s", p->name); /* Activate notification */
 		} else if (!ast_test_flag(p, IAX_TEMPONLY)) {
 			ast_verb(3, "Unregistered IAX2 '%s' (%s)\n", p->name,
 					    ast_test_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED) ? "AUTHENTICATED" : "UNAUTHENTICATED");
 			manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Unregistered\r\n", p->name);
 			register_peer_exten(p, 0);
 			ast_db_del("IAX/Registry", p->name);
-			ast_device_state_changed("IAX2/%s", p->name); /* Activate notification */
+			ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "IAX2/%s", p->name); /* Activate notification */
 		}
 		/* Update the host */
 		/* Verify that the host is really there */

Modified: team/tilghman/compiler_attributes/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/channels/chan_sip.c?view=diff&rev=111994&r1=111993&r2=111994
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_sip.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_sip.c Mon Mar 31 11:29:20 2008
@@ -4345,7 +4345,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);
 	}
 
@@ -14976,8 +14976,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);
-		r->timeout = -1;
+		AST_SCHED_DEL(sched, r->timeout);
 		if (r->call) {
 			r->call = NULL;
 			p->needdestroy = 1;
@@ -18580,7 +18579,7 @@
 
 	if (p->stimer->st_active == TRUE) {
 		p->stimer->st_active = FALSE;
-		ast_sched_del(sched, p->stimer->st_schedid);
+		AST_SCHED_DEL(sched, p->stimer->st_schedid);
 		ast_debug(2, "Session timer stopped: %d - %s\n", p->stimer->st_schedid, p->callid);
 	}
 }

Modified: team/tilghman/compiler_attributes/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/include/asterisk/config.h?view=diff&rev=111994&r1=111993&r2=111994
==============================================================================
--- team/tilghman/compiler_attributes/include/asterisk/config.h (original)
+++ team/tilghman/compiler_attributes/include/asterisk/config.h Mon Mar 31 11:29:20 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/tilghman/compiler_attributes/include/asterisk/devicestate.h
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/include/asterisk/devicestate.h?view=diff&rev=111994&r1=111993&r2=111994
==============================================================================
--- team/tilghman/compiler_attributes/include/asterisk/devicestate.h (original)
+++ team/tilghman/compiler_attributes/include/asterisk/devicestate.h Mon Mar 31 11:29:20 2008
@@ -158,7 +158,7 @@
  * \note This is deprecated in favor of ast_devstate_changed()
  */
 int ast_device_state_changed(const char *fmt, ...)
-	__attribute__ ((format (printf, 1, 2)));
+	__attribute__ ((deprecated,format (printf, 1, 2)));
 
 /*! 
  * \brief Tells Asterisk the State for Device is changed 
@@ -173,7 +173,8 @@
  *
  * \note This is deprecated in favor of ast_devstate_changed_literal()
  */
-int ast_device_state_changed_literal(const char *device);
+int ast_device_state_changed_literal(const char *device)
+	__attribute__ ((deprecated));
 
 /*! 
  * \brief Add device state provider 

Modified: team/tilghman/compiler_attributes/include/asterisk/logger.h
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/include/asterisk/logger.h?view=diff&rev=111994&r1=111993&r2=111994
==============================================================================
--- team/tilghman/compiler_attributes/include/asterisk/logger.h (original)
+++ team/tilghman/compiler_attributes/include/asterisk/logger.h Mon Mar 31 11:29:20 2008
@@ -78,8 +78,8 @@
 void ast_verbose(const char *fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
 
-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/tilghman/compiler_attributes/include/asterisk/sched.h
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/include/asterisk/sched.h?view=diff&rev=111994&r1=111993&r2=111994
==============================================================================
--- team/tilghman/compiler_attributes/include/asterisk/sched.h (original)
+++ team/tilghman/compiler_attributes/include/asterisk/sched.h Mon Mar 31 11:29:20 2008
@@ -112,7 +112,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
@@ -125,7 +125,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
@@ -140,7 +140,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
@@ -153,7 +153,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 Deletes a scheduled event
  * Remove this event from being run.  A procedure should not remove its own
@@ -164,7 +164,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
@@ -175,7 +175,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/tilghman/compiler_attributes/main/config.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/main/config.c?view=diff&rev=111994&r1=111993&r2=111994
==============================================================================
--- team/tilghman/compiler_attributes/main/config.c (original)
+++ team/tilghman/compiler_attributes/main/config.c Mon Mar 31 11:29:20 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]="";




More information about the asterisk-commits mailing list