From 37141f27d8e0689fe465d8498656ee6543de3ea5 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Sun, 25 Nov 2012 12:08:35 +0100 Subject: [PATCH] xml_entities(): use function strbuf_addstr_xml_quoted() Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- http-push.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/http-push.c b/http-push.c index 8701c1215..9923441a4 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, """); - break; - case '<': - strbuf_addstr(&buf, "<"); - break; - case '>': - strbuf_addstr(&buf, ">"); - break; - case '&': - strbuf_addstr(&buf, "&"); - break; - case 0: - return strbuf_detach(&buf, NULL); - } - s++; - } + strbuf_addstr_xml_quoted(&buf, s); return strbuf_detach(&buf, NULL); } -- 2.26.2