- for (attr = p->u.t.attr_list; attr; attr = attr->next)
- num++;
- if (!num)
- elements = (Z_AttributeElement**)odr_nullval();
- else
- {
- int i = 0;
- elements = (Z_AttributeElement **)
- odr_malloc (o, num*sizeof(*elements));
- for (attr = p->u.t.attr_list; attr; attr = attr->next, i++)
- {
- elements[i] = (Z_AttributeElement *)
- odr_malloc (o, sizeof(**elements));
- assert (elements[i]);
- elements[i]->attributeType =
- (int *)odr_malloc(o, sizeof(int));
- *elements[i]->attributeType = attr->type;
- elements[i]->attributeSet = 0;
- elements[i]->which = Z_AttributeValue_numeric;
- elements[i]->value.numeric =
- (int *)odr_malloc (o, sizeof(int));
- *elements[i]->value.numeric = attr->value;
- }
- }
-#ifdef ASN_COMPILED
- zapt->attributes = (Z_AttributeList *)
- odr_malloc (o, sizeof(*zapt->attributes));
- zapt->attributes->num_attributes = num;
- zapt->attributes->attributes = elements;
-#else
- zapt->num_attributes = num;
- zapt->attributeList = elements;
-#endif
- zapt->term = term;
- term->which = Z_Term_general;
- term->u.general = term_octet;
- term_octet->len = term_octet->size = strlen (p->u.t.term);
- term_octet->buf = (unsigned char *)odr_malloc (o, term_octet->len+1);
- strcpy ((char*) term_octet->buf, p->u.t.term);
- return zapt;