use "goto" instead of indistinct "break"

This commit is contained in:
Igor Sysoev 2007-02-20 14:36:48 +00:00
parent 83fe66212f
commit bb4c112fe5

View File

@ -141,14 +141,13 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
*/ */
if (rc == NGX_ERROR) { if (rc == NGX_ERROR) {
break; goto done;
} }
if (rc == NGX_CONF_BLOCK_DONE) { if (rc == NGX_CONF_BLOCK_DONE) {
if (!block) { if (!block) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\""); ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\"");
rc = NGX_ERROR; goto failed;
break;
} }
block = 0; block = 0;
@ -159,12 +158,11 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
"unexpected end of file in %s:%ui, expecting \"}\"", "unexpected end of file in %s:%ui, expecting \"}\"",
cf->conf_file->file.name.data, cf->conf_file->file.name.data,
cf->conf_file->line); cf->conf_file->line);
rc = NGX_ERROR; goto failed;
break;
} }
if (rc != NGX_OK && rc != NGX_CONF_BLOCK_START) { if (rc != NGX_OK && rc != NGX_CONF_BLOCK_START) {
break; goto done;
} }
if (cf->handler) { if (cf->handler) {
@ -180,26 +178,30 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
} }
if (rv == NGX_CONF_ERROR) { if (rv == NGX_CONF_ERROR) {
rc = NGX_ERROR; goto failed;
break;
} }
ngx_log_error(NGX_LOG_EMERG, cf->log, 0, ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
"%s in %s:%ui", "%s in %s:%ui",
rv, cf->conf_file->file.name.data, rv, cf->conf_file->file.name.data,
cf->conf_file->line); cf->conf_file->line);
rc = NGX_ERROR;
break; goto failed;
} }
rc = ngx_conf_handler(cf, rc); rc = ngx_conf_handler(cf, rc);
if (rc == NGX_ERROR) { if (rc == NGX_ERROR) {
break; goto failed;
} }
} }
failed:
rc = NGX_ERROR;
done:
if (filename) { if (filename) {
ngx_free(cf->conf_file->buffer->start); ngx_free(cf->conf_file->buffer->start);