summaryrefslogtreecommitdiff
path: root/http-push.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-01-05 23:41:04 -0800
committerJunio C Hamano <gitster@pobox.com>2013-01-05 23:41:04 -0800
commitbe7baf913a1c8e57fd871ebed17b47bec7687a9d (patch)
treedcd69e02fe906893dc49ac4bcf183f3b5c1cfa29 /http-push.c
parent990a4fea96983d54c0dcc96352e4c86404eceb77 (diff)
parent118a68f9ddbca6ffd87ab6e32b60771143d9d014 (diff)
downloadgit-be7baf913a1c8e57fd871ebed17b47bec7687a9d.tar.gz
Merge branch 'mh/unify-xml-in-imap-send-and-http-push'
Update imap-send to reuse xml quoting code from http-push codepath, clean up some code, and fix a small bug. * mh/unify-xml-in-imap-send-and-http-push: wrap_in_html(): process message in bulk rather than line-by-line wrap_in_html(): use strbuf_addstr_xml_quoted() imap-send: change msg_data from storing (ptr, len) to storing strbuf imap-send: correctly report errors reading from stdin imap-send: store all_msgs as a strbuf lf_to_crlf(): NUL-terminate msg_data::data xml_entities(): use function strbuf_addstr_xml_quoted() Add new function strbuf_add_xml_quoted()
Diffstat (limited to 'http-push.c')
-rw-r--r--http-push.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/http-push.c b/http-push.c
index 8701c1215d..9923441a4e 100644
--- a/http-push.c
+++ b/http-push.c
@@ -172,28 +172,7 @@ enum dav_header_flag {
static char *xml_entities(const char *s)
{
struct strbuf buf = STRBUF_INIT;
- while (*s) {
- size_t len = strcspn(s, "\"<>&");
- strbuf_add(&buf, s, len);
- s += len;
- switch (*s) {
- case '"':
- strbuf_addstr(&buf, "&quot;");
- break;
- case '<':
- strbuf_addstr(&buf, "&lt;");
- break;
- case '>':
- strbuf_addstr(&buf, "&gt;");
- break;
- case '&':
- strbuf_addstr(&buf, "&amp;");
- break;
- case 0:
- return strbuf_detach(&buf, NULL);
- }
- s++;
- }
+ strbuf_addstr_xml_quoted(&buf, s);
return strbuf_detach(&buf, NULL);
}