md_json_readf: dedent larger code block
Escape from the function if apr_file_open() fails; it's a bit easier on
the eyes. This patch is code motion only. No logical change is intended.
@@ -919,7 +919,10 @@ apr_status_t md_json_readf(md_json_t **pjson, apr_pool_t *p, const char *fpath)
json_error_t error;
rv = apr_file_open(&f, fpath, APR_FOPEN_READ, 0, p);
- if (rv == APR_SUCCESS) {
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+
j = json_load_callback(load_file_cb, f, 0, &error);
if (j) {
*pjson = json_create(p, j);
@@ -929,11 +932,10 @@ apr_status_t md_json_readf(md_json_t **pjson, apr_pool_t *p, const char *fpath)
"failed to load JSON file %s: %s (line %d:%d)",
fpath, error.text, error.line, error.column);
}
+
apr_file_close(f);
return (j && *pjson) ? APR_SUCCESS : APR_EINVAL;
}
- return rv;
-}
/**************************************************************************************************/
/* http get */
