X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=ccl%2Fcclqual.c;h=343d64f168a66de50e3737b5095a6d3e1cb7c508;hp=57a82a857e37955a2dc38624921bd67d42e915af;hb=3a14421799597d61196e2bb07bdd83396000cb45;hpb=a00dfa73d5d3796f8048f2134fec2685b62e2658 diff --git a/ccl/cclqual.c b/ccl/cclqual.c index 57a82a8..343d64f 100644 --- a/ccl/cclqual.c +++ b/ccl/cclqual.c @@ -45,7 +45,18 @@ * Europagate, 1995 * * $Log: cclqual.c,v $ - * Revision 1.7 1997-09-01 08:48:12 adam + * 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 + * Changed code so that it compiles as C++. + * + * Revision 1.8 1997/09/29 08:56:38 adam + * Changed CCL parser to be thread safe. New type, CCL_parser, declared + * and a create/destructers ccl_parser_create/ccl_parser/destory has + * been added. + * + * Revision 1.7 1997/09/01 08:48:12 adam * New windows NT/95 port using MSV5.0. Only a few changes made * to avoid warnings. * @@ -117,13 +128,13 @@ void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs) break; if (!q) { - struct ccl_qualifier *new_qual = malloc (sizeof(*new_qual)); + struct ccl_qualifier *new_qual = (struct ccl_qualifier *)malloc (sizeof(*new_qual)); assert (new_qual); new_qual->next = b->list; b->list = new_qual; - new_qual->name = malloc (strlen(name)+1); + new_qual->name = (char *)malloc (strlen(name)+1); assert (new_qual->name); strcpy (new_qual->name, name); attrp = &new_qual->attr_list; @@ -138,7 +149,7 @@ void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs) { struct ccl_rpn_attr *attr; - attr = malloc (sizeof(*attr)); + attr = (struct ccl_rpn_attr *)malloc (sizeof(*attr)); assert (attr); attr->type = *pairs++; attr->value = *pairs++; @@ -154,7 +165,7 @@ void ccl_qual_add (CCL_bibset b, const char *name, int no, int *pairs) */ CCL_bibset ccl_qual_mk (void) { - CCL_bibset b = malloc (sizeof(*b)); + CCL_bibset b = (CCL_bibset)malloc (sizeof(*b)); assert (b); b->list = NULL; return b; @@ -193,14 +204,18 @@ void ccl_qual_rm (CCL_bibset *b) * len: Length of name. * return: Attribute info. NULL if not found. */ -struct ccl_rpn_attr *ccl_qual_search (CCL_bibset b, const char *name, size_t len) +struct ccl_rpn_attr *ccl_qual_search (CCL_parser cclp, + const char *name, size_t len) { struct ccl_qualifier *q; - assert (b); - for (q = b->list; q; q = q->next) + assert (cclp); + if (!cclp->bibset) + return NULL; + for (q = cclp->bibset->list; q; q = q->next) if (strlen(q->name) == len) - if (ccl_case_sensitive) + { + if (cclp->ccl_case_sensitive) { if (!memcmp (name, q->name, len)) return q->attr_list; @@ -210,6 +225,7 @@ struct ccl_rpn_attr *ccl_qual_search (CCL_bibset b, const char *name, size_t len if (!ccl_memicmp (name, q->name, len)) return q->attr_list; } + } return NULL; }