Skip to content
Snippets Groups Projects
Commit 7fe5f346 authored by Luigi Rizzo's avatar Luigi Rizzo
Browse files

document a nice technique to exit from a block in case of errors.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91951 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent a077c8cb
Branches
Tags
No related merge requests found
...@@ -1153,6 +1153,11 @@ static struct ast_config *config_text_file_load(const char *database, const char ...@@ -1153,6 +1153,11 @@ static struct ast_config *config_text_file_load(const char *database, const char
for (i=0; i<globbuf.gl_pathc; i++) { for (i=0; i<globbuf.gl_pathc; i++) {
ast_copy_string(fn, globbuf.gl_pathv[i], sizeof(fn)); ast_copy_string(fn, globbuf.gl_pathv[i], sizeof(fn));
#endif #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 { do {
if (stat(fn, &statbuf)) if (stat(fn, &statbuf))
continue; continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment