X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=ccl%2Fcclqual.c;h=c19dede86d15964b6dc07201aef3b9aa680dee91;hp=343d64f168a66de50e3737b5095a6d3e1cb7c508;hb=448e7f2a48f6485a8d452c75420524fb37453bc1;hpb=3a14421799597d61196e2bb07bdd83396000cb45 diff --git a/ccl/cclqual.c b/ccl/cclqual.c index 343d64f..c19dede 100644 --- a/ccl/cclqual.c +++ b/ccl/cclqual.c @@ -45,7 +45,21 @@ * Europagate, 1995 * * $Log: cclqual.c,v $ - * Revision 1.10 1998-07-07 15:49:40 adam + * Revision 1.14 2000-11-16 09:58:02 adam + * Implemented local AttributeSet setting for CCL field maps. + * + * Revision 1.13 2000/01/31 13:15:21 adam + * Removed uses of assert(3). Cleanup of ODR. CCL parser update so + * that some characters are not surrounded by spaces in resulting term. + * ILL-code updates. + * + * Revision 1.12 1999/11/30 13:47:11 adam + * Improved installation. Moved header files to include/yaz. + * + * Revision 1.11 1999/03/31 11:15:37 adam + * Fixed memory leaks in ccl_find_str and ccl_qual_rm. + * + * Revision 1.10 1998/07/07 15:49:40 adam * Added braces to avoid warning. * * Revision 1.9 1998/02/11 11:53:33 adam @@ -98,10 +112,9 @@ #include #include -#include #include -#include +#include /* Definition of CCL_bibset pointer */ struct ccl_qualifiers { @@ -117,25 +130,27 @@ struct ccl_qualifiers { * pairs: Attributes. pairs[0] first type, pair[1] first value, * ... pair[2*no-2] last type, pair[2*no-1] last value. */ -void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs) +void ccl_qual_add_set (CCL_bibset b, const char *name, int no, int *pairs, + char **attsets) { struct ccl_qualifier *q; struct ccl_rpn_attr **attrp; - assert (b); + ccl_assert (b); for (q = b->list; q; q = q->next) if (!strcmp (name, q->name)) break; if (!q) { - struct ccl_qualifier *new_qual = (struct ccl_qualifier *)malloc (sizeof(*new_qual)); - assert (new_qual); + struct ccl_qualifier *new_qual = + (struct ccl_qualifier *)malloc (sizeof(*new_qual)); + ccl_assert (new_qual); new_qual->next = b->list; b->list = new_qual; new_qual->name = (char *)malloc (strlen(name)+1); - assert (new_qual->name); + ccl_assert (new_qual->name); strcpy (new_qual->name, name); attrp = &new_qual->attr_list; } @@ -150,7 +165,8 @@ void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs) struct ccl_rpn_attr *attr; attr = (struct ccl_rpn_attr *)malloc (sizeof(*attr)); - assert (attr); + ccl_assert (attr); + attr->set = *attsets++; attr->type = *pairs++; attr->value = *pairs++; *attrp = attr; @@ -166,7 +182,7 @@ void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs) CCL_bibset ccl_qual_mk (void) { CCL_bibset b = (CCL_bibset)malloc (sizeof(*b)); - assert (b); + ccl_assert (b); b->list = NULL; return b; } @@ -188,9 +204,12 @@ void ccl_qual_rm (CCL_bibset *b) for (attr = q->attr_list; attr; attr = attr1) { attr1 = attr->next; + if (attr->set) + free (attr->set); free (attr); } q1 = q->next; + free (q->name); free (q); } free (*b); @@ -209,7 +228,7 @@ struct ccl_rpn_attr *ccl_qual_search (CCL_parser cclp, { struct ccl_qualifier *q; - assert (cclp); + ccl_assert (cclp); if (!cclp->bibset) return NULL; for (q = cclp->bibset->list; q; q = q->next)