| 802 | } |
| 803 | |
| 804 | void 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, """); |
| 813 | break; |
| 814 | case '<': |
| 815 | strbuf_addstr(buf, "<"); |
| 816 | break; |
| 817 | case '>': |
| 818 | strbuf_addstr(buf, ">"); |
| 819 | break; |
| 820 | case '&': |
| 821 | strbuf_addstr(buf, "&"); |
| 822 | break; |
| 823 | case 0: |
| 824 | return; |
| 825 | } |
| 826 | s++; |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | static void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len, |
| 831 | char_predicate allow_unencoded_fn) |
no test coverage detected