conf: reduce indentation in load_config_file()
This replaces a do { ... } while (0) with break statements
ba gotos. Imho, this is much clearer.
Michael
			
			
This commit is contained in:
		
							parent
							
								
									d3df735f89
								
							
						
					
					
						commit
						54a613b9db
					
				@ -389,24 +389,23 @@ static int load_config_file (const char *config_fname, struct config_s *conf)
 | 
				
			|||||||
        FILE *config_file;
 | 
					        FILE *config_file;
 | 
				
			||||||
        int ret = -1;
 | 
					        int ret = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        do {
 | 
					 | 
				
			||||||
        config_file = fopen (config_fname, "r");
 | 
					        config_file = fopen (config_fname, "r");
 | 
				
			||||||
        if (!config_file) {
 | 
					        if (!config_file) {
 | 
				
			||||||
                fprintf (stderr,
 | 
					                fprintf (stderr,
 | 
				
			||||||
                         "%s: Could not open config file \"%s\".\n",
 | 
					                         "%s: Could not open config file \"%s\".\n",
 | 
				
			||||||
                         PACKAGE, config_fname);
 | 
					                         PACKAGE, config_fname);
 | 
				
			||||||
                        break;
 | 
					                goto done;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (config_compile () || config_parse (conf, config_file)) {
 | 
					        if (config_compile () || config_parse (conf, config_file)) {
 | 
				
			||||||
                fprintf (stderr, "Unable to parse config file. "
 | 
					                fprintf (stderr, "Unable to parse config file. "
 | 
				
			||||||
                         "Not starting.\n");
 | 
					                         "Not starting.\n");
 | 
				
			||||||
                        break;
 | 
					                goto done;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ret = 0;
 | 
					        ret = 0;
 | 
				
			||||||
        } while (0);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					done:
 | 
				
			||||||
        if (config_file)
 | 
					        if (config_file)
 | 
				
			||||||
                fclose (config_file);
 | 
					                fclose (config_file);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user