aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Harvey <peter.a.harvey@gmail.com>2006-02-04 17:16:25 +0800
committerPeter Anthony Harvey <paharvey@src.gnome.org>2006-02-04 17:16:25 +0800
commitf0a9cca06cffa42a88ef20f80004ed99609efee1 (patch)
treed80ba7786b5b7158b9762ec28b91999636b36c87
parent7f8ddd100dc991a9106674571fb9c5a6ca1845cb (diff)
downloadgsoc2013-epiphany-f0a9cca06cffa42a88ef20f80004ed99609efee1.tar.gz
gsoc2013-epiphany-f0a9cca06cffa42a88ef20f80004ed99609efee1.tar.zst
gsoc2013-epiphany-f0a9cca06cffa42a88ef20f80004ed99609efee1.zip
src/bookmarks/ephy-bookmarks.c
2006-02-04 Peter Harvey <peter.a.harvey@gmail.com> * src/bookmarks/ephy-bookmarks.c Improve code quality of function to determine similar bookmarks.
-rw-r--r--ChangeLog6
-rw-r--r--src/bookmarks/ephy-bookmarks.c37
2 files changed, 23 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index e45ef60b4..06ee364e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-02-04 Peter Harvey <peter.a.harvey@gmail.com>
+
+ * src/bookmarks/ephy-bookmarks.c
+
+ Improve code quality of function to determine similar bookmarks.
+
2006-02-03 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-main.c: (main):
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 36a3455d5..35c9e7eab 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -1189,26 +1189,23 @@ ephy_bookmarks_find_bookmark (EphyBookmarks *eb,
static gboolean
is_similar (const char *url1, const char *url2)
{
- while(*url1 == *url2 && *url1 != '\0' &&
- *url1 != '#' && *url1 != '?')
- {
- url1++;
- url2++;
- }
- if(*url1 == *url2) return TRUE;
- if(*url1 == '\0')
- {
- if(*url2 == '#') return TRUE;
- if(*url2 == '?') return TRUE;
- if(*url2 == '/' && *(url2+1) == '\0') return TRUE;
- }
- if(*url2 == '\0')
- {
- if(*url1 == '#') return TRUE;
- if(*url1 == '?') return TRUE;
- if(*url1 == '/' && *(url1+1) == '\0') return TRUE;
- }
- return FALSE;
+ int i, j;
+
+ for (i = 0; url1[i]; i++)
+ if (url1[i] == '#' || url1[i] == '?')
+ break;
+ while(i>0 && url1[i] == '/')
+ i--;
+
+ for (j = 0; url2[j]; j++)
+ if (url2[j] == '#' || url2[j] == '?')
+ break;
+ while(j>0 && url2[j] == '/')
+ j--;
+
+ if (i != j) return FALSE;
+ if (strncmp (url1, url2, i) != 0) return FALSE;
+ return TRUE;
}
gint