diff options
author | Peter Harvey <peter.a.harvey@gmail.com> | 2006-02-04 17:16:25 +0800 |
---|---|---|
committer | Peter Anthony Harvey <paharvey@src.gnome.org> | 2006-02-04 17:16:25 +0800 |
commit | f0a9cca06cffa42a88ef20f80004ed99609efee1 (patch) | |
tree | d80ba7786b5b7158b9762ec28b91999636b36c87 /src/bookmarks/ephy-bookmarks.c | |
parent | 7f8ddd100dc991a9106674571fb9c5a6ca1845cb (diff) | |
download | gsoc2013-epiphany-f0a9cca06cffa42a88ef20f80004ed99609efee1.tar gsoc2013-epiphany-f0a9cca06cffa42a88ef20f80004ed99609efee1.tar.gz gsoc2013-epiphany-f0a9cca06cffa42a88ef20f80004ed99609efee1.tar.bz2 gsoc2013-epiphany-f0a9cca06cffa42a88ef20f80004ed99609efee1.tar.lz gsoc2013-epiphany-f0a9cca06cffa42a88ef20f80004ed99609efee1.tar.xz 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.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 37 |
1 files changed, 17 insertions, 20 deletions
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 |