Hiroyuki Ikezoe
ikezo****@users*****
Fri Mar 16 14:20:31 JST 2007
Index: kazehakase/src/bookmarks/kz-bookmark-filter.c diff -u kazehakase/src/bookmarks/kz-bookmark-filter.c:1.5 kazehakase/src/bookmarks/kz-bookmark-filter.c:1.6 --- kazehakase/src/bookmarks/kz-bookmark-filter.c:1.5 Wed Mar 14 15:42:59 2007 +++ kazehakase/src/bookmarks/kz-bookmark-filter.c Fri Mar 16 14:20:31 2007 @@ -26,10 +26,10 @@ #include <ctype.h> #include <sys/types.h> -#include "eggregex.h" #include "kazehakase.h" #include "kz-profile.h" #include "utils.h" +#include "glib-utils.h" #ifndef REG_NOERROR #define REG_NOERROR (0) @@ -68,10 +68,7 @@ gboolean kz_bookmark_filter_out (KzBookmark *bookmark) { -#if 0 - regex_t preg; - regmatch_t mat; - int ret; + GRegex *regex; GList *list, *node; const gchar *title, *uri; @@ -87,6 +84,7 @@ const gchar *key = node->data; const gchar *str = NULL; gchar *exp; + gboolean match; KzBookmarkFilterType key_type; if (!key || !*key) continue; @@ -109,17 +107,16 @@ exp = kz_profile_get_string(KZ_GET_GLOBAL_PROFILE, "ExtractLinks", key); - ret = regcomp(&preg, exp, 0); - if (ret != REG_NOERROR) continue; + regex = g_regex_new(exp, 0, 0, NULL); - ret = regexec(&preg, uri, 1, &mat, 0); + match = g_regex_match(regex, str, 0); g_free(exp); - regfree(&preg); + g_regex_free(regex); - if (ret == 0) + if (match) return TRUE; } -#endif + return FALSE; }