Minor patch for ephy-location-entry



Simple patch for ephy-location-entry to avoid doing many g_strconcat and
g_free's within completion_func. No significant gains here, just
trimming something which seems wasteful.

Index: lib/widgets/ephy-location-entry.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/widgets/ephy-location-entry.c,v
retrieving revision 1.42
diff -u -r1.42 ephy-location-entry.c
--- lib/widgets/ephy-location-entry.c	17 Mar 2004 09:02:37 -0000	1.42
+++ lib/widgets/ephy-location-entry.c	26 Oct 2004 01:01:13 -0000
@@ -236,7 +236,7 @@
 		 GtkTreeIter *iter,
 		 gpointer data)
 {
-	int i;
+	int i, len_key, len_web;
 	char *item = NULL;
 	char *keywords = NULL;
 	gboolean ret = FALSE;
@@ -250,7 +250,8 @@
 			    le->priv->keywords_col, &keywords,
 			    -1);
 
-	if (!strncmp (key, item, strlen (key)))
+        len_key = strlen (key);
+	if (!strncmp (key, item, len_key))
 	{
 		ret = TRUE;
 	}
@@ -262,19 +263,13 @@
 	{
 		for (i = 0; i < n_web_prefixes; i++)
 		{
-			char *key_prefixed;
-
-			key_prefixed = g_strconcat (web_prefixes[i], key, NULL);
-
-			if (!strncmp (key_prefixed, item, strlen (key_prefixed)))
-			{
-				g_free (key_prefixed);
-
-				ret = TRUE;
-				break;
-			}
-
-			g_free (key_prefixed);
+                        len_web = strlen (web_prefixes[i]);
+                        if (!strncmp (web_prefixes[i], item, len_web) &&
+                            !strncmp (key, item+len_web, len_key))
+                        {
+                                ret = TRUE;
+                                break;
+                        }
 		}
 	}
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]