summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-01-16 13:26:18 +0100
committerMichael Adam <obnox@samba.org>2010-01-16 13:26:18 +0100
commit54a613b9db74e71af8e4083f639a039a4d7853a1 (patch)
tree47e8e235e2fa2ed35186a4f210d75335a816a384 /src
parentd3df735f89ba754213153c316aad711d4bdd49b4 (diff)
conf: reduce indentation in load_config_file()
This replaces a do { ... } while (0) with break statements ba gotos. Imho, this is much clearer. Michael
Diffstat (limited to 'src')
-rw-r--r--src/conf.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/conf.c b/src/conf.c
index 26289ba..45f3126 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -389,24 +389,23 @@ static int load_config_file (const char *config_fname, struct config_s *conf)
FILE *config_file;
int ret = -1;
- do {
- config_file = fopen (config_fname, "r");
- if (!config_file) {
- fprintf (stderr,
- "%s: Could not open config file \"%s\".\n",
- PACKAGE, config_fname);
- break;
- }
+ config_file = fopen (config_fname, "r");
+ if (!config_file) {
+ fprintf (stderr,
+ "%s: Could not open config file \"%s\".\n",
+ PACKAGE, config_fname);
+ goto done;
+ }
- if (config_compile () || config_parse (conf, config_file)) {
- fprintf (stderr, "Unable to parse config file. "
- "Not starting.\n");
- break;
- }
+ if (config_compile () || config_parse (conf, config_file)) {
+ fprintf (stderr, "Unable to parse config file. "
+ "Not starting.\n");
+ goto done;
+ }
- ret = 0;
- } while (0);
+ ret = 0;
+done:
if (config_file)
fclose (config_file);