aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-07 16:29:29 +0100
committerMax Kellermann <max@duempel.org>2009-11-07 16:29:29 +0100
commitc2251dc5a29a6dff029fca7fab55c0a60ae76104 (patch)
tree5764ddd1feffe3520a565a49b6b3b2545f87e320 /src
parenta505cbc6c9e1d6fe5fed222673c647eb5252c24d (diff)
downloadmpd-c2251dc5a29a6dff029fca7fab55c0a60ae76104.tar.gz
mpd-c2251dc5a29a6dff029fca7fab55c0a60ae76104.tar.xz
mpd-c2251dc5a29a6dff029fca7fab55c0a60ae76104.zip
exclude: use GPatternSpec instead of fnmatch()
GLib's version of fnmatch() is more portable.
Diffstat (limited to '')
-rw-r--r--src/exclude.c10
1 files 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 <string.h>
#include <stdio.h>
#include <errno.h>
-#include <fnmatch.h>
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;
}