summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2008-02-23 19:13:57 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-02-23 19:14:01 (UTC)
commite0572c39f78b4f88c706a49a60e211302b8e015c (patch) (side-by-side diff)
tree4432d0400549c7ea521eea1dffddfbb2f96de0c6
parente5ed227ef0da561e2bde8646ec816842392377ee (diff)
parenteacde43d7184452e1fdc90b982b531f1f5239923 (diff)
downloadcgit-e0572c39f78b4f88c706a49a60e211302b8e015c.zip
cgit-e0572c39f78b4f88c706a49a60e211302b8e015c.tar.gz
cgit-e0572c39f78b4f88c706a49a60e211302b8e015c.tar.bz2
Merge branch 'stable'
* stable: Fix segfault Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--html.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/html.c b/html.c
index eb163d9..339bf00 100644
--- a/html.c
+++ b/html.c
@@ -45,15 +45,13 @@ void htmlf(const char *format, ...)
void html_txt(char *txt)
{
char *t = txt;
while(t && *t){
int c = *t;
if (c=='<' || c=='>' || c=='&') {
- *t = '\0';
- html(txt);
- *t = c;
+ write(htmlfd, txt, t - txt);
if (c=='>')
html("&gt;");
else if (c=='<')
html("&lt;");
else if (c=='&')
html("&amp;");
@@ -68,44 +66,36 @@ void html_txt(char *txt)
void html_ntxt(int len, char *txt)
{
char *t = txt;
while(t && *t && len--){
int c = *t;
if (c=='<' || c=='>' || c=='&') {
- *t = '\0';
- html(txt);
- *t = c;
+ write(htmlfd, txt, t - txt);
if (c=='>')
html("&gt;");
else if (c=='<')
html("&lt;");
else if (c=='&')
html("&amp;");
txt = t+1;
}
t++;
}
- if (t!=txt) {
- char c = *t;
- *t = '\0';
- html(txt);
- *t = c;
- }
+ if (t!=txt)
+ write(htmlfd, txt, t - txt);
if (len<0)
html("...");
}
void html_attr(char *txt)
{
char *t = txt;
while(t && *t){
int c = *t;
if (c=='<' || c=='>' || c=='\'') {
- *t = '\0';
- html(txt);
- *t = c;
+ write(htmlfd, txt, t - txt);
if (c=='>')
html("&gt;");
else if (c=='<')
html("&lt;");
else if (c=='\'')
html("&quote;");