From 6cf7c0bdb8d8e4a101771d234830539c2f55dc0e Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 26 Oct 2006 23:49:14 +0000 Subject: [PATCH] Change prototype for data1_absyn_getmarctab, data1_absyn_getelements. --- data1/d1_absyn.c | 16 ++++++++++------ include/idzebra/data1.h | 6 +++--- index/marcread.c | 10 +++++----- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/data1/d1_absyn.c b/data1/d1_absyn.c index feff7ce..eac90f7 100644 --- a/data1/d1_absyn.c +++ b/data1/d1_absyn.c @@ -1,4 +1,4 @@ -/* $Id: d1_absyn.c,v 1.30 2006-09-29 10:02:45 adam Exp $ +/* $Id: d1_absyn.c,v 1.31 2006-10-26 23:49:14 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -659,15 +659,19 @@ int read_absyn_line(FILE *f, int *lineno, char *line, int len, return argc; } -data1_marctab *data1_absyn_getmarctab(data1_handle dh, data1_absyn *absyn) +data1_marctab *data1_absyn_getmarctab(data1_handle dh, data1_node *root) { - return absyn->marc; + if (root->u.root.absyn) + return root->u.root.absyn->marc; + return 0; } -YAZ_EXPORT data1_element *data1_absyn_getelements(data1_handle dh, - data1_absyn *absyn) +data1_element *data1_absyn_getelements(data1_handle dh, + data1_node *root) { - return absyn->main_elements; + if (root->u.root.absyn) + return root->u.root.absyn->main_elements; + return 0; } static data1_absyn *data1_read_absyn(data1_handle dh, const char *file, diff --git a/include/idzebra/data1.h b/include/idzebra/data1.h index b527f5b..81af828 100644 --- a/include/idzebra/data1.h +++ b/include/idzebra/data1.h @@ -1,4 +1,4 @@ -/* $Id: data1.h,v 1.18 2006-08-14 10:40:14 adam Exp $ +/* $Id: data1.h,v 1.19 2006-10-26 23:49:14 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -502,9 +502,9 @@ YAZ_EXPORT data1_node *data1_map_record(data1_handle dh, data1_node *n, YAZ_EXPORT data1_marctab *data1_read_marctab (data1_handle dh, const char *file); YAZ_EXPORT data1_marctab *data1_absyn_getmarctab(data1_handle dh, - data1_absyn *absyn); + data1_node *root); YAZ_EXPORT data1_element *data1_absyn_getelements(data1_handle dh, - data1_absyn *absyn); + data1_node *root); YAZ_EXPORT char *data1_nodetomarc(data1_handle dh, data1_marctab *p, data1_node *n, int selected, int *len); YAZ_EXPORT char *data1_nodetoidsgml(data1_handle dh, data1_node *n, diff --git a/index/marcread.c b/index/marcread.c index 67065bf..d04b039 100644 --- a/index/marcread.c +++ b/index/marcread.c @@ -1,4 +1,4 @@ -/* $Id: marcread.c,v 1.4 2006-10-12 10:13:33 adam Exp $ +/* $Id: marcread.c,v 1.5 2006-10-26 23:49:14 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -116,7 +116,7 @@ static data1_node *grs_read_iso2709 (struct grs_read_info *p, int marc_xml) else res_top = data1_mk_tag (p->dh, p->mem, absynName, 0, res_root); - if ((marctab = data1_absyn_getmarctab(p->dh, res_root->u.root.absyn))) + if ((marctab = data1_absyn_getmarctab(p->dh, res_root))) { memcpy(marctab->leader, buf, 24); memcpy(marctab->implementation_codes, buf+6, 4); @@ -706,7 +706,7 @@ static int is_empty(char *s) static void parse_data1_tree(struct grs_read_info *p, const char *mc_stmnt, data1_node *root) { - data1_marctab *marctab = data1_absyn_getmarctab(p->dh, root->u.root.absyn); + data1_marctab *marctab = data1_absyn_getmarctab(p->dh, root); data1_node *top = root->child; data1_node *field; mc_context *c; @@ -790,7 +790,7 @@ data1_node *grs_read_marcxml(struct grs_read_info *p) if (!root) return 0; - for (e = data1_absyn_getelements(p->dh, root->u.root.absyn); e; e=e->next) + for (e = data1_absyn_getelements(p->dh, root); e; e=e->next) { data1_tag *tag = e->tag; @@ -809,7 +809,7 @@ data1_node *grs_read_marc(struct grs_read_info *p) if (!root) return 0; - for (e = data1_absyn_getelements(p->dh, root->u.root.absyn); e; e=e->next) + for (e = data1_absyn_getelements(p->dh, root); e; e=e->next) { data1_tag *tag = e->tag; -- 1.7.10.4