diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-01 08:45:29 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-01 08:45:29 +0000 |
commit | ac9233994229105764d181ef1dbb12fb079aac50 (patch) | |
tree | 8259e5de1687651afe37845d86258320df02a0ba /channel.c | |
parent | c92403c4798c56013b7df7d00a69a9128896327a (diff) |
remove some duplicated code (issue #6098)
Also, touch up some formatting
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7691 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rw-r--r-- | channel.c | 23 |
1 files changed, 5 insertions, 18 deletions
@@ -808,16 +808,15 @@ struct ast_channel *ast_get_channel_by_exten_locked(const char *exten, const cha } /*! \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 @@ int ast_safe_sleep_conditional( struct ast_channel *chan, int ms, /*! \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) |