/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_MATCH_H
#define LABWC_MATCH_H
-#include <glib.h>
+
#include <stdbool.h>
/**
* @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 */
// SPDX-License-Identifier: GPL-2.0-only
-#define _POSIX_C_SOURCE 200809L
+
+#include <fnmatch.h>
#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;
}
-