changeset 1519:d3ff7d80b8fb

[gaim-migrate @ 1529] faster is_smiley check committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 27 Feb 2001 21:01:40 +0000
parents e85a3a0e0975
children f9f1e3bc1918
files src/gtkimhtml.c src/gtkimhtml.h
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkimhtml.c	Tue Feb 27 18:41:11 2001 +0000
+++ b/src/gtkimhtml.c	Tue Feb 27 21:01:40 2001 +0000
@@ -186,6 +186,8 @@
 	gdk_cursor_destroy (imhtml->arrow_cursor);
 
 	g_hash_table_destroy (imhtml->smiley_hash);
+	if (imhtml->smiley_start)
+		g_string_free (imhtml->smiley_start, TRUE);
 
 	if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
 		(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -1480,6 +1482,12 @@
 	if (strlen (text) > imhtml->smax)
 		imhtml->smax = strlen (text);
 
+	if (!imhtml->smiley_start)
+		imhtml->smiley_start = g_string_new ("");
+
+	if (!strchr (imhtml->smiley_start->str, text [0]))
+		imhtml->smiley_start = g_string_append_c (imhtml->smiley_start, text [0]);
+
 	if (xpm == NULL)
 		g_hash_table_remove (imhtml->smiley_hash, text);
 	else
@@ -1805,6 +1813,9 @@
 	g_return_val_if_fail (GTK_IS_IMHTML (imhtml), 0);
 	g_return_val_if_fail (text != NULL, 0);
 
+	if (!imhtml->smiley_start || !strchr (imhtml->smiley_start->str, text [0]))
+		return 0;
+
 	tmp = g_malloc (imhtml->smax + 1);
 
 	for (i = imhtml->smin; i <= imhtml->smax; i++) {
--- a/src/gtkimhtml.h	Tue Feb 27 18:41:11 2001 +0000
+++ b/src/gtkimhtml.h	Tue Feb 27 21:01:40 2001 +0000
@@ -72,6 +72,7 @@
 	gboolean comments;
 
 	GHashTable *smiley_hash;
+	GString *smiley_start;
 	gint smin, smax;
 };