comparison src/core/ngx_conf_file.c @ 1123:88dc269bbca2

use "goto" instead of indistinct "break"
author Igor Sysoev <igor@sysoev.ru>
date Tue, 20 Feb 2007 14:36:48 +0000
parents 3728476ab96d
children f1a8c6cd10ba
comparison
equal deleted inserted replaced
1122:3728476ab96d 1123:88dc269bbca2
139 * NGX_CONF_BLOCK_DONE the "}" was found 139 * NGX_CONF_BLOCK_DONE the "}" was found
140 * NGX_CONF_FILE_DONE the configuration file is done 140 * NGX_CONF_FILE_DONE the configuration file is done
141 */ 141 */
142 142
143 if (rc == NGX_ERROR) { 143 if (rc == NGX_ERROR) {
144 break; 144 goto done;
145 } 145 }
146 146
147 if (rc == NGX_CONF_BLOCK_DONE) { 147 if (rc == NGX_CONF_BLOCK_DONE) {
148 if (!block) { 148 if (!block) {
149 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\""); 149 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\"");
150 rc = NGX_ERROR; 150 goto failed;
151 break;
152 } 151 }
153 152
154 block = 0; 153 block = 0;
155 } 154 }
156 155
157 if (rc == NGX_CONF_FILE_DONE && block) { 156 if (rc == NGX_CONF_FILE_DONE && block) {
158 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, 157 ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
159 "unexpected end of file in %s:%ui, expecting \"}\"", 158 "unexpected end of file in %s:%ui, expecting \"}\"",
160 cf->conf_file->file.name.data, 159 cf->conf_file->file.name.data,
161 cf->conf_file->line); 160 cf->conf_file->line);
162 rc = NGX_ERROR; 161 goto failed;
163 break;
164 } 162 }
165 163
166 if (rc != NGX_OK && rc != NGX_CONF_BLOCK_START) { 164 if (rc != NGX_OK && rc != NGX_CONF_BLOCK_START) {
167 break; 165 goto done;
168 } 166 }
169 167
170 if (cf->handler) { 168 if (cf->handler) {
171 169
172 /* 170 /*
178 if (rv == NGX_CONF_OK) { 176 if (rv == NGX_CONF_OK) {
179 continue; 177 continue;
180 } 178 }
181 179
182 if (rv == NGX_CONF_ERROR) { 180 if (rv == NGX_CONF_ERROR) {
183 rc = NGX_ERROR; 181 goto failed;
184 break;
185 } 182 }
186 183
187 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, 184 ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
188 "%s in %s:%ui", 185 "%s in %s:%ui",
189 rv, cf->conf_file->file.name.data, 186 rv, cf->conf_file->file.name.data,
190 cf->conf_file->line); 187 cf->conf_file->line);
191 rc = NGX_ERROR; 188
192 break; 189 goto failed;
193 } 190 }
194 191
195 192
196 rc = ngx_conf_handler(cf, rc); 193 rc = ngx_conf_handler(cf, rc);
197 194
198 if (rc == NGX_ERROR) { 195 if (rc == NGX_ERROR) {
199 break; 196 goto failed;
200 } 197 }
201 } 198 }
202 199
200 failed:
201
202 rc = NGX_ERROR;
203
204 done:
203 205
204 if (filename) { 206 if (filename) {
205 ngx_free(cf->conf_file->buffer->start); 207 ngx_free(cf->conf_file->buffer->start);
206 208
207 cf->conf_file = prev; 209 cf->conf_file = prev;