[asterisk-commits] trunk r20396 - /trunk/channel.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Apr 16 01:01:13 MST 2006


Author: rizzo
Date: Sun Apr 16 03:01:10 2006
New Revision: 20396

URL: http://svn.digium.com/view/asterisk?rev=20396&view=rev
Log:
localize some variables, add some comments.


Modified:
    trunk/channel.c

Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=20396&r1=20395&r2=20396&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Sun Apr 16 03:01:10 2006
@@ -1769,19 +1769,18 @@
 
 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 @@
 			/* 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_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 @@
 	if (!len)
 		return -1;
 	for (;;) {
+		int d;
 		if (c->stream) {
 			d = ast_waitstream_full(c, AST_DIGIT_ANY, audiofd, ctrlfd);
 			ast_stopstream(c);



More information about the asterisk-commits mailing list