diff --git a/include/common/match.h b/include/common/match.h index c49f2187..477f1ade 100644 --- a/include/common/match.h +++ b/include/common/match.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #ifndef LABWC_MATCH_H #define LABWC_MATCH_H -#include + #include /** @@ -10,6 +10,6 @@ * @string: String to search. * Note: Comparison case-insensitive. */ -bool match_glob(const gchar *pattern, const gchar *string); +bool match_glob(const char *pattern, const char *string); #endif /* LABWC_MATCH_H */ diff --git a/src/common/match.c b/src/common/match.c index 6c573fb9..9bc3cf8b 100644 --- a/src/common/match.c +++ b/src/common/match.c @@ -1,15 +1,10 @@ // SPDX-License-Identifier: GPL-2.0-only -#define _POSIX_C_SOURCE 200809L + +#include #include "common/match.h" bool -match_glob(const gchar *pattern, const gchar *string) +match_glob(const char *pattern, const char *string) { - gchar *p = g_utf8_casefold(pattern, -1); - gchar *s = g_utf8_casefold(string, -1); - bool ret = g_pattern_match_simple(p, s); - g_free(p); - g_free(s); - return ret; + return fnmatch(pattern, string, FNM_CASEFOLD) == 0; } -