From c2251dc5a29a6dff029fca7fab55c0a60ae76104 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 7 Nov 2009 16:29:29 +0100 Subject: exclude: use GPatternSpec instead of fnmatch() GLib's version of fnmatch() is more portable. --- src/exclude.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/exclude.c b/src/exclude.c index 4a1fb21f6..59354fa82 100644 --- a/src/exclude.c +++ b/src/exclude.c @@ -29,7 +29,6 @@ #include #include #include -#include GSList * exclude_list_load(const char *path_fs) @@ -59,7 +58,7 @@ exclude_list_load(const char *path_fs) p = g_strstrip(line); if (*p != 0) - list = g_slist_prepend(list, g_strdup(p)); + list = g_slist_prepend(list, g_pattern_spec_new(p)); } fclose(file); @@ -71,7 +70,8 @@ void exclude_list_free(GSList *list) { while (list != NULL) { - g_free(list->data); + GPatternSpec *pattern = list->data; + g_pattern_spec_free(pattern); list = g_slist_remove(list, list->data); } } @@ -84,9 +84,9 @@ exclude_list_check(GSList *list, const char *name_fs) /* XXX include full path name in check */ for (; list != NULL; list = list->next) { - const char *pattern = list->data; + GPatternSpec *pattern = list->data; - if (fnmatch(pattern, name_fs, FNM_PATHNAME|FNM_PERIOD) == 0) + if (g_pattern_match_string(pattern, name_fs)) return true; } -- cgit v1.2.3