X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fyaz-ccl.c;h=6c856427ed14356115cfcf16f228a862ea6252ff;hb=6a7d650e44134d161a4614a5e68245216dec2b19;hp=178bf8587e371a8b248dc89e69ae09a07392214d;hpb=73fc91ec903170c76d464c4ed7a83eb9ce635a1d;p=yaz-moved-to-github.git diff --git a/util/yaz-ccl.c b/util/yaz-ccl.c index 178bf85..6c85642 100644 --- a/util/yaz-ccl.c +++ b/util/yaz-ccl.c @@ -1,10 +1,17 @@ /* - * Copyright (c) 1996, Index Data. + * Copyright (c) 1996-1997, Index Data. * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * * $Log: yaz-ccl.c,v $ - * Revision 1.9 1997-06-23 10:31:25 adam + * Revision 1.11 1997-11-24 11:33:57 adam + * Using function odr_nullval() instead of global ODR_NULLVAL when + * appropriate. + * + * Revision 1.10 1997/09/29 08:58:25 adam + * Fixed conversion of trees so that true copy is made. + * + * Revision 1.9 1997/06/23 10:31:25 adam * Added ODR argument to ccl_rpn_query and ccl_scan_query. * * Revision 1.8 1996/10/29 13:36:27 adam @@ -52,25 +59,24 @@ static Z_AttributesPlusTerm *ccl_rpn_term (ODR o, struct ccl_rpn_node *p) odr_malloc (o, sizeof(**zapt->attributeList)); assert (zapt->attributeList[i]); zapt->attributeList[i]->attributeType = - &attr->type; -#ifdef Z_95 + odr_malloc(o, sizeof(int)); + *zapt->attributeList[i]->attributeType = attr->type; zapt->attributeList[i]->attributeSet = 0; zapt->attributeList[i]->which = Z_AttributeValue_numeric; - zapt->attributeList[i]->value.numeric = &attr->value; -#else - zapt->attributeList[i]->attributeValue = - &attr->value; -#endif + zapt->attributeList[i]->value.numeric = + odr_malloc (o, sizeof(int)); + *zapt->attributeList[i]->value.numeric = attr->value; } } else - zapt->attributeList = ODR_NULLVAL; + zapt->attributeList = odr_nullval(); zapt->term = term; term->which = Z_Term_general; term->u.general = term_octet; - term_octet->buf = (unsigned char*) p->u.t.term; term_octet->len = term_octet->size = strlen (p->u.t.term); + term_octet->buf = odr_malloc (o, term_octet->len+1); + strcpy ((char*) term_octet->buf, p->u.t.term); return zapt; } @@ -112,15 +118,15 @@ static Z_Complex *ccl_rpn_complex (ODR o, struct ccl_rpn_node *p) { case CCL_RPN_AND: zo->which = Z_Operator_and; - zo->u.and = ODR_NULLVAL; + zo->u.and = odr_nullval(); break; case CCL_RPN_OR: zo->which = Z_Operator_or; - zo->u.and = ODR_NULLVAL; + zo->u.and = odr_nullval(); break; case CCL_RPN_NOT: zo->which = Z_Operator_and_not; - zo->u.and = ODR_NULLVAL; + zo->u.and = odr_nullval(); break; default: assert (0);