X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fnormalize_record.c;h=70082fd99aa9d2b3c666c6b4db33435ca71849cb;hb=64dccf5757a22cedd3c21ca834e3e02f39dd0504;hp=036c96e74ae0d3d913cb9ac84dbac2b72fa6c8e5;hpb=b59997bafbaf3c7f3bd5e28ce58b061b18d06433;p=pazpar2-moved-to-github.git diff --git a/src/normalize_record.c b/src/normalize_record.c index 036c96e..70082fd 100644 --- a/src/normalize_record.c +++ b/src/normalize_record.c @@ -66,6 +66,7 @@ normalize_record_t normalize_record_create(struct conf_service *service, if (!xsp_doc) no_errors++; + else { *m = nmem_malloc(nt->nmem, sizeof(**m)); (*m)->marcmap = NULL; @@ -88,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)))) { @@ -106,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; } }