X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fattribute.c;h=7595591f4ffe30c51752ca4da1f3c2df3eb112f5;hb=b9093505b17a074e79137ed64595c8269f77d330;hp=78af3c15e6f407e16e4dcaa9f866cb2dd59ce523;hpb=5f8ba9f35bd3c9aeafe26613021f2edd141b8611;p=idzebra-moved-to-github.git diff --git a/index/attribute.c b/index/attribute.c index 78af3c1..7595591 100644 --- a/index/attribute.c +++ b/index/attribute.c @@ -1,10 +1,14 @@ /* - * Copyright (C) 1994-1995, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: attribute.c,v $ - * Revision 1.5 1997-09-05 15:30:08 adam + * Revision 1.6 1997-09-17 12:19:11 adam + * Zebra version corresponds to YAZ version 1.4. + * Changed Zebra server so that it doesn't depend on global common_resource. + * + * Revision 1.5 1997/09/05 15:30:08 adam * Changed prototype for chr_map_input - added const. * Added support for C++, headers uses extern "C" for public definitions. * @@ -26,30 +30,26 @@ #include #include -#include #include -#include "attribute.h" - -static int initialized = 0; - -static data1_attset *registered_sets = 0; +#include "zserver.h" -static void att_loadset(const char *n, const char *name) +static void att_loadset(void *p, const char *n, const char *name) { data1_attset *cnew; + ZServerInfo *zi = p; - if (!(cnew = data1_read_attset((char*) name))) + if (!(cnew = data1_read_attset(zi->dh, (char*) name))) { logf(LOG_WARN|LOG_ERRNO, "%s", name); return; } - cnew->next = registered_sets; - registered_sets = cnew; + cnew->next = zi->registered_sets; + zi->registered_sets = cnew; } -static void load_atts() +static void load_atts(ZServerInfo *zi) { - res_trav(common_resource, "attset", att_loadset); + res_trav(zi->res, "attset", zi, att_loadset); } static data1_att *getatt(data1_attset *p, int att) @@ -69,23 +69,19 @@ static data1_att *getatt(data1_attset *p, int att) return 0; } -attent *att_getentbyatt(oid_value set, int att) +int att_getentbyatt(ZServerInfo *zi, attent *res, oid_value set, int att) { - static attent res; data1_att *r; data1_attset *p; - if (!initialized) - { - initialized = 1; - load_atts(); - } - for (p = registered_sets; p; p = p->next) + if (!zi->registered_sets) + load_atts(zi); + for (p = zi->registered_sets; p; p = p->next) if (p->reference == set && (r = getatt(p, att))) break;; if (!p) return 0; - res.attset_ordinal = r->parent->ordinal; - res.local_attributes = r->locals; - return &res; + res->attset_ordinal = r->parent->ordinal; + res->local_attributes = r->locals; + return 1; }