From 9f2cd71aedc3226946464d49c8f172bebeb2cb82 Mon Sep 17 00:00:00 2001 From: Moritz Grimm Date: Tue, 17 Jul 2018 10:31:25 +0200 Subject: [PATCH] Define "ezstream" only once --- src/cfgfile_xml.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cfgfile_xml.c b/src/cfgfile_xml.c index ac6b586..4ee21d6 100644 --- a/src/cfgfile_xml.c +++ b/src/cfgfile_xml.c @@ -28,6 +28,8 @@ #include +#define CFGFILE_XML_NAME "ezstream" + static int _cfgfile_xml_parse_server(xmlDocPtr, xmlNodePtr); static int _cfgfile_xml_parse_servers(xmlDocPtr, xmlNodePtr); static int _cfgfile_xml_parse_stream(xmlDocPtr, xmlNodePtr); @@ -480,8 +482,9 @@ cfgfile_xml_parse(const char *config_file) log_error("%s: empty document", config_file); goto error; } - if (0 != xmlStrcasecmp(cur->name, XML_CHAR("ezstream"))) { - log_error("%s: not ezstream config", config_file); + if (0 != xmlStrcasecmp(cur->name, XML_CHAR(CFGFILE_XML_NAME))) { + log_error("%s: %s configuration not recognized", config_file, + CFGFILE_XML_NAME); goto error; } @@ -693,7 +696,7 @@ _cfgfile_xml_print_encoder(cfg_encoder_t e, void *arg) void cfgfile_xml_print(FILE *fp) { - fprintf(fp, "\n"); + fprintf(fp, "<%s>\n", CFGFILE_XML_NAME); fprintf(fp, "\n"); fprintf(fp, " \n"); cfg_server_list_foreach(cfg_get_servers(), _cfgfile_xml_print_server, @@ -745,5 +748,5 @@ cfgfile_xml_print(FILE *fp) fprintf(fp, " yes\n"); fprintf(fp, " \n"); } - fprintf(fp, "\n"); + fprintf(fp, "\n", CFGFILE_XML_NAME); }