From f7ef24a2c00221a64bc41d0ac34893ce03bb9636 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 1 Sep 2014 14:55:19 +0200 Subject: [PATCH] Fix warning about about missing (internal) stylesheet PAZ-956 --- etc/settings/testserver.xml | 2 +- src/normalize_record.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/etc/settings/testserver.xml b/etc/settings/testserver.xml index 69a8c36..fdb7767 100644 --- a/etc/settings/testserver.xml +++ b/etc/settings/testserver.xml @@ -3,7 +3,7 @@ - + diff --git a/src/normalize_record.c b/src/normalize_record.c index ea15f46..70082fd 100644 --- a/src/normalize_record.c +++ b/src/normalize_record.c @@ -89,17 +89,15 @@ normalize_record_t normalize_record_create(struct conf_service *service, for (i = 0; i < num; i++) { - WRBUF fname = conf_get_fname(conf, stylesheets[i]); - *m = nmem_malloc(nt->nmem, sizeof(**m)); (*m)->marcmap = NULL; (*m)->stylesheet1 = NULL; - (*m)->stylesheet2 = service_xslt_get(service, stylesheets[i]); if ((*m)->stylesheet2) ; else if (!strcmp(&stylesheets[i][strlen(stylesheets[i])-4], ".xsl")) { + WRBUF fname = conf_get_fname(conf, stylesheets[i]); if (!((*m)->stylesheet1 = xsltParseStylesheetFile((xmlChar *) wrbuf_cstr(fname)))) { @@ -107,23 +105,24 @@ normalize_record_t normalize_record_create(struct conf_service *service, stylesheets[i]); no_errors++; } + wrbuf_destroy(fname); } else if (!strcmp(&stylesheets[i][strlen(stylesheets[i])-5], ".mmap")) { + WRBUF fname = conf_get_fname(conf, stylesheets[i]); if (!((*m)->marcmap = marcmap_load(wrbuf_cstr(fname), nt->nmem))) { yaz_log(YLOG_FATAL|YLOG_ERRNO, "Unable to load marcmap: %s", stylesheets[i]); no_errors++; } + wrbuf_destroy(fname); } else { yaz_log(YLOG_FATAL, "Cannot handle stylesheet: %s", stylesheets[i]); no_errors++; } - - wrbuf_destroy(fname); m = &(*m)->next; } } -- 1.7.10.4