[asterisk-commits] trunk - r7691 /trunk/channel.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Jan 1 02:45:31 CST 2006
Author: russell
Date: Sun Jan 1 02:45:29 2006
New Revision: 7691
URL: http://svn.digium.com/view/asterisk?rev=7691&view=rev
Log:
remove some duplicated code (issue #6098)
Also, touch up some formatting
Modified:
trunk/channel.c
Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=7691&r1=7690&r2=7691&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Sun Jan 1 02:45:29 2006
@@ -808,16 +808,15 @@
}
/*! \brief Wait, look for hangups and condition arg */
-int ast_safe_sleep_conditional( struct ast_channel *chan, int ms,
- int (*cond)(void*), void *data )
+int ast_safe_sleep_conditional(struct ast_channel *chan, int ms, int (*cond)(void*), void *data)
{
struct ast_frame *f;
- while(ms > 0) {
- if( cond && ((*cond)(data) == 0 ) )
+ while (ms > 0) {
+ if (cond && ((*cond)(data) == 0))
return 0;
ms = ast_waitfor(chan, ms);
- if (ms <0)
+ if (ms < 0)
return -1;
if (ms > 0) {
f = ast_read(chan);
@@ -832,19 +831,7 @@
/*! \brief Wait, look for hangups */
int ast_safe_sleep(struct ast_channel *chan, int ms)
{
- struct ast_frame *f;
- while(ms > 0) {
- ms = ast_waitfor(chan, ms);
- if (ms <0)
- return -1;
- if (ms > 0) {
- f = ast_read(chan);
- if (!f)
- return -1;
- ast_frfree(f);
- }
- }
- return 0;
+ return ast_safe_sleep_conditional(chan, ms, NULL, NULL);
}
static void free_cid(struct ast_callerid *cid)
More information about the asterisk-commits
mailing list