X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=data1%2Fd1_expout.c;h=560f6ca84cd87d9688217be042f79ee02394188c;hp=f1ad9f476e1e7481ce9d5ad5f6e4b21b20f703da;hb=97a7adeb9e5059463f039495cc01cfa448463a27;hpb=4478d785b7769691261005c98063b98a5a5971b3 diff --git a/data1/d1_expout.c b/data1/d1_expout.c index f1ad9f4..560f6ca 100644 --- a/data1/d1_expout.c +++ b/data1/d1_expout.c @@ -1,8 +1,5 @@ -/* $Id: d1_expout.c,v 1.8 2006-08-14 10:40:06 adam Exp $ - Copyright (C) 1995-2006 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) 1995-2008 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -30,6 +27,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include +#include +#include #include typedef struct { @@ -113,31 +112,15 @@ static bool_t *f_bool(ExpHandle *eh, data1_node *c) static Odr_oid *f_oid(ExpHandle *eh, data1_node *c, oid_class oclass) { char oidstr[64]; - int oid_this[20]; - oid_value value_for_this; c = c->child; if (!is_data_tag (eh, c) || c->u.data.len > 63) return 0; - sprintf(oidstr, "%.*s", c->u.data.len, c->u.data.data); - value_for_this = oid_getvalbyname(oidstr); - if (value_for_this == VAL_NONE) - { - Odr_oid *oid = odr_getoidbystr(eh->o, oidstr); - assert (oid); - return oid; - } - else - { - struct oident ident; + yaz_snprintf(oidstr, sizeof(oidstr)-1, + "%.*s", c->u.data.len, c->u.data.data); - ident.oclass = oclass; - ident.proto = PROTO_Z3950; - ident.value = value_for_this; - - oid_ent_to_oid (&ident, oid_this); - } - return odr_oiddup (eh->o, oid_this); + return yaz_string_to_oid_odr(yaz_oid_std(), + CLASS_GENERAL, oidstr, eh->o); } static Z_IntUnit *f_intunit(ExpHandle *eh, data1_node *c) @@ -201,7 +184,7 @@ Odr_oid **f_oid_seq (ExpHandle *eh, data1_node *n, int *num, oid_class oclass) ++(*num); if (!*num) return NULL; - res = (int **)odr_malloc (eh->o, sizeof(*res) * (*num)); + res = (Odr_oid **)odr_malloc (eh->o, sizeof(*res) * (*num)); for (c = n->child, i = 0 ; c; c = c->next) if (is_numeric_tag (eh, c) == 1000) res[i++] = f_oid (eh, c, oclass);