/** * xsltFreeAVTList: * @avt: pointer to an list of AVT structures * * Free up the memory associated to the attribute value templates */ void xsltFreeAVTList(void *avt) { xsltAttrVTPtr cur = (xsltAttrVTPtr) avt, next; while (cur != NULL) { next = cur->next; xsltFreeAttrVT(cur); cur = next; } }
/** * xsltSetAttrVTsegment: * @ avt: pointer to an xsltAttrVT structure * @ val: the value to be set to the next available segment * * Within xsltCompileAttr there are several places where a value * needs to be added to the 'segments' array within the xsltAttrVT * structure, and at each place the allocated size may have to be * re-allocated. This routine takes care of that situation. * * Returns the avt pointer, which may have been changed by a re-alloc */ static xsltAttrVTPtr xsltSetAttrVTsegment(xsltAttrVTPtr avt, void *val) { if (avt->nb_seg >= avt->max_seg) { size_t size = sizeof(xsltAttrVT) + (avt->max_seg + MAX_AVT_SEG) * sizeof(void *); xsltAttrVTPtr tmp = (xsltAttrVTPtr) xmlRealloc(avt, size); if (tmp == NULL) { xsltFreeAttrVT(avt); return NULL; } avt = tmp; memset(&avt->segments[avt->nb_seg], 0, MAX_AVT_SEG*sizeof(void *)); avt->max_seg += MAX_AVT_SEG; } avt->segments[avt->nb_seg++] = val; return avt; }