X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Frecord_conv.c;h=a74b4c55a6f0753d00f8eb8d765f2c7c41be7885;hb=20c28e99eaa71d4b73e8c03c8cfaf23653948da7;hp=1595faf2ceb49a5601bc27cbf8b70bc2652b3c40;hpb=80d0b86c41a5934878cb51657e92060909f320f4;p=yaz-moved-to-github.git diff --git a/src/record_conv.c b/src/record_conv.c index 1595faf..a74b4c5 100644 --- a/src/record_conv.c +++ b/src/record_conv.c @@ -378,19 +378,18 @@ static int convert_select(void *vinfo, WRBUF record, WRBUF wr_error) if (xpathObj) { xmlNodeSetPtr nodes = xpathObj->nodesetval; - wrbuf_rewind(record); if (nodes) { int i; + if (nodes->nodeNr > 0) + wrbuf_rewind(record); for (i = 0; i < nodes->nodeNr; i++) { xmlNode *ptr = nodes->nodeTab[i]; - fprintf(stderr, "xpath result %d type=%d\n", i, - ptr->type); if (ptr->type == XML_ELEMENT_NODE) ptr = ptr->children; - if (ptr->type == XML_TEXT_NODE) - for (; ptr; ptr = ptr->next) + for (; ptr; ptr = ptr->next) + if (ptr->type == XML_TEXT_NODE) wrbuf_puts(record, (const char *) ptr->content); } } @@ -403,8 +402,12 @@ static int convert_select(void *vinfo, WRBUF record, WRBUF wr_error) return ret; } -static void destroy_select(void *info) +static void destroy_select(void *vinfo) { + struct select_info *info = vinfo; + + if (info) + nmem_destroy(info->nmem); }