diff src/util.c @ 765:bf31bf916f53

[gaim-migrate @ 775] no, if the away message gets modified, it'll be modified many many times. you won't notice it until you run out of space committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 25 Aug 2000 05:04:41 +0000
parents a566fc987db9
children be917c4d3e39
line wrap: on
line diff
--- a/src/util.c	Fri Aug 25 04:17:06 2000 +0000
+++ b/src/util.c	Fri Aug 25 05:04:41 2000 +0000
@@ -1107,29 +1107,31 @@
 	return;
 }
 
-void stylize(gchar *text, int length)
+char *stylize(gchar *text, int length)
 {
 	gchar *buf;	
+	char tmp[length];
 
 	buf = g_malloc(length);
+	g_snprintf(buf, length, "%s", text);
 
 	if (font_options & OPT_FONT_FACE)
 	{
-		g_snprintf(buf, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, text);
-		strcpy(text, buf);
+		g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, buf);
+		strcpy(buf, tmp);
 	}
 
 	if (font_options & OPT_FONT_FGCOL)
 	{
-		g_snprintf(buf, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", fgcolor.red, fgcolor.green, fgcolor.blue, text);
-		strcpy(text, buf);
+		g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", fgcolor.red, fgcolor.green, fgcolor.blue, buf);
+		strcpy(buf, tmp);
 	}
 
 	if (font_options & OPT_FONT_BGCOL)
 	{
-		g_snprintf(buf, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", bgcolor.red, bgcolor.green, bgcolor.blue, text);
-		strcpy(text, buf);
+		g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", bgcolor.red, bgcolor.green, bgcolor.blue, buf);
+		strcpy(buf, tmp);
 	}
 	
-	g_free(buf);
-}
\ No newline at end of file
+	return buf;
+}