395 void dav_xml_add_attr(DavXmlNode *node, const char *name, const char *value) { |
395 void dav_xml_add_attr(DavXmlNode *node, const char *name, const char *value) { |
396 DavXmlAttr *attr = calloc(1, sizeof(DavXmlAttr)); |
396 DavXmlAttr *attr = calloc(1, sizeof(DavXmlAttr)); |
397 attr->name = strdup(name); |
397 attr->name = strdup(name); |
398 attr->value = strdup(value); |
398 attr->value = strdup(value); |
399 |
399 |
400 if(node->attributes) { |
400 if(node->attributes) { |
401 DavXmlAttr *last; |
|
402 DavXmlAttr *end = node->attributes; |
401 DavXmlAttr *end = node->attributes; |
|
402 DavXmlAttr* last = end; |
403 while(end) { |
403 while(end) { |
404 last = end; |
404 last = end; |
405 end = end->next; |
405 end = end->next; |
406 } |
406 } |
407 last->next = attr; |
407 last->next = attr; |