about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2008-02-23 20:13:57 +0100
committerLars Hjemli <hjemli@gmail.com>2008-02-23 20:14:01 +0100
commite0572c39f78b4f88c706a49a60e211302b8e015c (patch)
tree4432d0400549c7ea521eea1dffddfbb2f96de0c6
parentUse GIT-1.5.4.1 (diff)
parentFix segfault (diff)
downloadcgit-pink-e0572c39f78b4f88c706a49a60e211302b8e015c.tar.gz
cgit-pink-e0572c39f78b4f88c706a49a60e211302b8e015c.zip
Merge branch 'stable'
* stable:
  Fix segfault

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-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
@@ -48,9 +48,7 @@ void html_txt(char *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=='<')
@@ -71,9 +69,7 @@ void html_ntxt(int len, char *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=='<')
@@ -84,12 +80,8 @@ void html_ntxt(int len, char *txt)
 		}
 		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("...");
 }
@@ -100,9 +92,7 @@ void html_attr(char *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=='<')
19Add The Obelisk GateJune McEnroe 2020-02-17Add Four Tet — HandsJune McEnroe One from the cafe that caught my attention. 2020-02-12Simplify macOS notify-sendJune McEnroe 2020-02-12Add imbox and notemap to pageJune McEnroe 2020-02-12Collapse simple linksJune McEnroe 2020-02-12Move catgirl up the pageJune McEnroe 2020-02-12Update catgirl pty grabJune McEnroe 2020-02-12Link to cgit /about pages where appropriateJune McEnroe 2020-02-11Separate LINKS from BINS for html to workJune McEnroe 2020-02-11Add margin to Bl-bullet itemsJune McEnroe 2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe 2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe Apparently sometimes it didn't like receiving its own internal storage to parse again. Understandable. 2020-02-09Add To Be Taught, If FortunateJune McEnroe 2020-02-04Add The Future of Another TimelineJune McEnroe Wow. One of the best I've read. 2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe Broke out LDLIBS for each bin, and made everything more uniform. 2020-01-28Change scout sensitivity to 1.4June McEnroe idk it seems to work. 2020-01-28Import shows.txtJune McEnroe