[asterisk-commits] rizzo: trunk r91951 - /trunk/main/config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Dec 8 11:58:09 CST 2007


Author: rizzo
Date: Sat Dec  8 11:58:08 2007
New Revision: 91951

URL: http://svn.digium.com/view/asterisk?view=rev&rev=91951
Log:
document a nice technique to exit from a block in case of errors.

Modified:
    trunk/main/config.c

Modified: trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/trunk/main/config.c?view=diff&rev=91951&r1=91950&r2=91951
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Sat Dec  8 11:58:08 2007
@@ -1153,6 +1153,11 @@
 			for (i=0; i<globbuf.gl_pathc; i++) {
 				ast_copy_string(fn, globbuf.gl_pathv[i], sizeof(fn));
 #endif
+	/*
+	 * The following is not a loop, but just a convenient way to define a block
+	 * (using do { } while(0) ), and be able to exit from it with 'continue'
+	 * or 'break' in case of errors. Nice trick.
+	 */
 	do {
 		if (stat(fn, &statbuf))
 			continue;




More information about the asterisk-commits mailing list