-/* $Id: config.c,v 1.7 2007-01-09 18:06:28 quinn Exp $ */
+/* $Id: config.c,v 1.10 2007-01-12 15:08:44 quinn Exp $ */
#include <string.h>
{
xmlNode *n;
struct conf_service *r = nmem_malloc(nmem, sizeof(struct conf_service));
- int num_metadata = 0;
int md_node = 0;
+ r->num_sortkeys = r->num_metadata = 0;
// Allocate array of conf metadata structs, if necessary
for (n = node->children; n; n = n->next)
if (n->type == XML_ELEMENT_NODE && !strcmp(n->name, "metadata"))
- num_metadata++;
- if (num_metadata)
- r->metadata = nmem_malloc(nmem, sizeof(struct conf_metadata) * num_metadata);
- r->num_metadata = num_metadata;
+ {
+ xmlChar *sortkey = xmlGetProp(n, "sortkey");
+ r->num_metadata++;
+ if (sortkey && strcmp(sortkey, "no"))
+ r->num_sortkeys++;
+ xmlFree(sortkey);
+ }
+ if (r->num_metadata)
+ r->metadata = nmem_malloc(nmem, sizeof(struct conf_metadata) * r->num_metadata);
+ else
+ r->metadata = 0;
+ if (r->num_sortkeys)
+ r->sortkeys = nmem_malloc(nmem, sizeof(struct conf_sortkey) * r->num_sortkeys);
+ else
+ r->sortkeys = 0;
for (n = node->children; n; n = n->next)
{
xmlChar *charset = xmlGetProp(n, "charset");
xmlChar *format = xmlGetProp(n, "format");
xmlChar *stylesheet = xmlGetProp(n, "stylesheet");
- bzero(m, sizeof(*m));
+ memset(m, 0, sizeof(*m));
if (type)
{
if (!strcmp(type, "xslt"))
yaz_log(YLOG_FATAL, "Failed to read %s", fname);
exit(1);
}
- if ((p = rindex(fname, '/')))
+ if ((p = strrchr(fname, '/')))
{
int len = p - fname;
strncpy(confdir, fname, len);