X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=data1%2Fd1_expout.c;h=416465b7227eaba71729ffdd50d2aeb884edc649;hp=f51cab04710cb3ec4e6f41ff0123fed7cbe53525;hb=1b8e1d7dfece31918056f76819c18675ed6e781e;hpb=6c9fcd3b5d3108702fa1ffc92dab4ab6060f9a19 diff --git a/data1/d1_expout.c b/data1/d1_expout.c index f51cab0..416465b 100644 --- a/data1/d1_expout.c +++ b/data1/d1_expout.c @@ -1,5 +1,5 @@ -/* $Id: d1_expout.c,v 1.6 2005-01-15 19:38:18 adam Exp $ - Copyright (C) 1995-2005 +/* $Id: d1_expout.c,v 1.11 2007-05-08 12:50:03 adam Exp $ + Copyright (C) 1995-2007 Index Data ApS This file is part of the Zebra server. @@ -15,9 +15,9 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Zebra; see the file LICENSE.zebra. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ /* @@ -30,6 +30,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include +#include +#include #include typedef struct { @@ -113,31 +115,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 +187,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); @@ -1418,3 +1404,11 @@ Z_ExplainRecord *data1_nodetoexplain (data1_handle dh, data1_node *n, yaz_log(YLOG_WARN, "No category in Explain record"); return 0; } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +