aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-16 08:01:10 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-16 08:01:10 +0000
commit4e21113090684465ee00765997da1dad08855dbf (patch)
tree05fd1dcb82a900075fc50641f796ce9b35692f96 /channel.c
parent1ab52a857a5a9f7ebb3cd7bd2918394fdf17ffd0 (diff)
localize some variables, add some comments.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@20396 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rw-r--r--channel.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/channel.c b/channel.c
index 0add8638e..3e3bda6c9 100644
--- a/channel.c
+++ b/channel.c
@@ -1769,19 +1769,18 @@ int ast_settimeout(struct ast_channel *c, int samples, int (*func)(void *data),
int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
{
- struct ast_frame *f;
- struct ast_channel *rchan;
- int outfd;
- int res;
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
return -1;
/* Wait for a digit, no more than ms milliseconds total. */
- while(ms) {
+ while (ms) {
+ struct ast_channel *rchan;
+ int outfd;
+
errno = 0;
rchan = ast_waitfor_nandfds(&c, 1, &cmdfd, (cmdfd > -1) ? 1 : 0, NULL, &outfd, &ms);
- if ((!rchan) && (outfd < 0) && (ms)) {
+ if (!rchan && outfd < 0 && ms) {
if (errno == 0 || errno == EINTR)
continue;
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));
@@ -1790,10 +1789,10 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
/* The FD we were watching has something waiting */
return 1;
} else if (rchan) {
- f = ast_read(c);
- if(!f) {
+ int res;
+ struct ast_frame *f = ast_read(c);
+ if (!f)
return -1;
- }
switch(f->frametype) {
case AST_FRAME_DTMF:
@@ -2699,9 +2698,8 @@ int ast_readstring(struct ast_channel *c, char *s, int len, int timeout, int fti
int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, int ftimeout, char *enders, int audiofd, int ctrlfd)
{
- int pos=0;
+ int pos = 0; /* index in the buffer where we accumulate digits */
int to = ftimeout;
- int d;
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
@@ -2709,6 +2707,7 @@ int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, in
if (!len)
return -1;
for (;;) {
+ int d;
if (c->stream) {
d = ast_waitstream_full(c, AST_DIGIT_ANY, audiofd, ctrlfd);
ast_stopstream(c);