Use new conffile code in main.c; remove wrappers

This commit is contained in:
Julien BLACHE 2009-04-18 17:30:14 +02:00
parent bacdddb82f
commit bbab963fe2
3 changed files with 10 additions and 20 deletions

View File

@ -36,9 +36,7 @@
#define CONF_E_BADCONFIG 12 #define CONF_E_BADCONFIG 12
#define CONF_E_NOTSUPP 13 #define CONF_E_NOTSUPP 13
extern int conf_read(char *file);
extern int conf_reload(void); extern int conf_reload(void);
extern int conf_close(void);
extern int conf_get_int(char *section, char *key, int dflt); extern int conf_get_int(char *section, char *key, int dflt);
extern int conf_get_string(char *section, char *key, char *dflt, extern int conf_get_string(char *section, char *key, char *dflt,
char *out, int *size); char *out, int *size);

View File

@ -336,19 +336,6 @@ conffile_unload(void)
/* Wrappers for old configfile handling */ /* Wrappers for old configfile handling */
#include "conf.h" #include "conf.h"
int
conf_read(char *file)
{
return conffile_load(file);
}
int
conf_close(void)
{
conffile_unload();
return 0;
}
int int
conf_get_int(char *section, char *key, int dflt) conf_get_int(char *section, char *key, int dflt)
{ {

View File

@ -82,6 +82,7 @@
#include "daapd.h" #include "daapd.h"
#include "conffile.h"
#include "conf.h" #include "conf.h"
#include "configfile.h" #include "configfile.h"
#include "err.h" #include "err.h"
@ -591,10 +592,13 @@ int main(int argc, char *argv[]) {
config.stats.start_time=start_time=(int)time(NULL); config.stats.start_time=start_time=(int)time(NULL);
config.stop=0; config.stop=0;
if(CONF_E_SUCCESS != conf_read(configfile)) { ret = conffile_load(configfile);
fprintf(stderr,"Error reading config file (%s)\n",configfile); if (ret != 0)
exit(EXIT_FAILURE); {
} fprintf(stderr, "Config file errors; please fix your config\n");
exit(EXIT_FAILURE);
}
if(debuglevel) /* was specified, should override the config file */ if(debuglevel) /* was specified, should override the config file */
err_setlevel(debuglevel); err_setlevel(debuglevel);
@ -842,7 +846,8 @@ int main(int argc, char *argv[]) {
ws_stop(config.server); ws_stop(config.server);
*/ */
free(web_root); free(web_root);
conf_close();
conffile_unload();
DPRINTF(E_LOG,L_MAIN|L_DB,"Closing database\n"); DPRINTF(E_LOG,L_MAIN|L_DB,"Closing database\n");
db_deinit(); db_deinit();