MCPcopy Create free account
hub / github.com/git/git / strbuf_addstr_xml_quoted

Function strbuf_addstr_xml_quoted

strbuf.c:804–828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802}
803
804void strbuf_addstr_xml_quoted(struct strbuf *buf, const char *s)
805{
806 while (*s) {
807 size_t len = strcspn(s, "\"<>&");
808 strbuf_add(buf, s, len);
809 s += len;
810 switch (*s) {
811 case '"':
812 strbuf_addstr(buf, "&quot;");
813 break;
814 case '<':
815 strbuf_addstr(buf, "&lt;");
816 break;
817 case '>':
818 strbuf_addstr(buf, "&gt;");
819 break;
820 case '&':
821 strbuf_addstr(buf, "&amp;");
822 break;
823 case 0:
824 return;
825 }
826 s++;
827 }
828}
829
830static void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
831 char_predicate allow_unencoded_fn)

Callers 2

xml_entitiesFunction · 0.85
wrap_in_htmlFunction · 0.85

Calls 2

strbuf_addFunction · 0.85
strbuf_addstrFunction · 0.85

Tested by

no test coverage detected