MCPcopy Create free account
hub / github.com/acl-dev/acl / xml_parse_attr_val

Function xml_parse_attr_val

lib_acl/src/xml/acl_xml2_parse.c:683–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

681}
682
683static const char *xml_parse_attr_val(ACL_XML2 *xml, const char *data)
684{
685 int ch;
686 ACL_XML2_ATTR *attr = xml->curr_node->curr_attr;
687
688 if (attr->value == xml->dummy && !attr->quote) {
689 SKIP_SPACE(data);
690 if (IS_QUOTE(*data))
691 attr->quote = *data++;
692 }
693
694 if (*data == 0)
695 return data;
696
697 if (attr->value == xml->dummy)
698 attr->value = END(xml);
699
700 while ((ch = *data) != 0) {
701 if (attr->quote) {
702 if (ch == attr->quote) {
703 if (NO_SPACE(xml))
704 return data;
705 data++;
706 attr->value_size = (ssize_t)
707 (END(xml) - attr->value);
708 ADD(xml, '\0');
709 xml->curr_node->status = ACL_XML2_S_ATTR;
710 xml->curr_node->last_ch = ch;
711 break;
712 }
713
714 if (NO_SPACE(xml))
715 return data;
716 ADD(xml, ch);
717 xml->curr_node->last_ch = ch;
718 } else if (ch == '>') {
719 if (NO_SPACE(xml))
720 return data;
721 data++;
722 attr->value_size = (ssize_t) (END(xml) - attr->value);
723 ADD(xml, '\0');
724
725 xml_parse_check_self_closed(xml);
726
727 if ((xml->curr_node->flag & ACL_XML2_F_SELF_CL)
728 && xml->curr_node->last_ch == '/')
729 {
730 if (--attr->value_size >= 0)
731 attr->value[attr->value_size] = 0;
732 xml->curr_node->status = ACL_XML2_S_RGT;
733 } else
734 xml->curr_node->status = ACL_XML2_S_LGT;
735 break;
736 } else if (IS_SPACE(ch)) {
737 if (NO_SPACE(xml))
738 return data;
739 data++;
740 attr->value_size = (ssize_t) (END(xml) - attr->value);

Callers

nothing calls this directly

Calls 4

acl_xml_decodeFunction · 0.85
acl_htable_findFunction · 0.85
acl_htable_enterFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…