From 00b6d96fd1220b1df82036c445389ae19a08709e Mon Sep 17 00:00:00 2001 From: Cloudwalk Date: Sat, 31 Jul 2021 12:45:42 -0400 Subject: [PATCH] common: Move filematch headers to new filematch.h --- common.c | 2 +- common.h | 16 ------------- darkplaces-sdl2-vs2017.vcxproj | 1 + darkplaces-sdl2-vs2019.vcxproj | 1 + darkplaces.h | 1 + filematch.h | 42 ++++++++++++++++++++++++++++++++++ 6 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 filematch.h diff --git a/common.c b/common.c index 5af54cae..8db1f270 100644 --- a/common.c +++ b/common.c @@ -1,6 +1,6 @@ /* Copyright (C) 1996-1997 Id Software, Inc. -Copyright (C) 2000-2021 DarkPlaces contributors +Copyright (C) 2000-2020 DarkPlaces contributors This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/common.h b/common.h index 9b662173..441d9ce9 100644 --- a/common.h +++ b/common.h @@ -339,22 +339,6 @@ qbool COM_StringDecolorize(const char *in, size_t size_in, char *out, size_t siz void COM_ToLowerString (const char *in, char *out, size_t size_out); void COM_ToUpperString (const char *in, char *out, size_t size_out); -typedef struct stringlist_s -{ - /// maxstrings changes as needed, causing reallocation of strings[] array - int maxstrings; - int numstrings; - char **strings; -} stringlist_t; - -int matchpattern(const char *in, const char *pattern, int caseinsensitive); -int matchpattern_with_separator(const char *in, const char *pattern, int caseinsensitive, const char *separators, qbool wildcard_least_one); -void stringlistinit(stringlist_t *list); -void stringlistfreecontents(stringlist_t *list); -void stringlistappend(stringlist_t *list, const char *text); -void stringlistsort(stringlist_t *list, qbool uniq); -void listdirectory(stringlist_t *list, const char *basepath, const char *path); - // strlcat and strlcpy, from OpenBSD // Most (all?) BSDs already have them #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(MACOSX) diff --git a/darkplaces-sdl2-vs2017.vcxproj b/darkplaces-sdl2-vs2017.vcxproj index c1168b76..85519a61 100644 --- a/darkplaces-sdl2-vs2017.vcxproj +++ b/darkplaces-sdl2-vs2017.vcxproj @@ -343,6 +343,7 @@ + diff --git a/darkplaces-sdl2-vs2019.vcxproj b/darkplaces-sdl2-vs2019.vcxproj index e1faf1e5..47ae7893 100644 --- a/darkplaces-sdl2-vs2019.vcxproj +++ b/darkplaces-sdl2-vs2019.vcxproj @@ -344,6 +344,7 @@ + diff --git a/darkplaces.h b/darkplaces.h index adf1581a..f04d904b 100644 --- a/darkplaces.h +++ b/darkplaces.h @@ -47,6 +47,7 @@ extern char engineversion[128]; #include "thread.h" #include "com_infostring.h" #include "common.h" +#include "filematch.h" #include "fs.h" #include "host.h" #include "cvar.h" diff --git a/filematch.h b/filematch.h new file mode 100644 index 00000000..a35fee6e --- /dev/null +++ b/filematch.h @@ -0,0 +1,42 @@ +/* +Copyright (C) 2006-2021 DarkPlaces contributors + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#ifndef FILEMATCH_H +#define FILEMATCH_H + +#include "qtypes.h" + +typedef struct stringlist_s +{ + /// maxstrings changes as needed, causing reallocation of strings[] array + int maxstrings; + int numstrings; + char **strings; +} stringlist_t; + +int matchpattern(const char *in, const char *pattern, int caseinsensitive); +int matchpattern_with_separator(const char *in, const char *pattern, int caseinsensitive, const char *separators, qbool wildcard_least_one); +void stringlistinit(stringlist_t *list); +void stringlistfreecontents(stringlist_t *list); +void stringlistappend(stringlist_t *list, const char *text); +void stringlistsort(stringlist_t *list, qbool uniq); +void listdirectory(stringlist_t *list, const char *basepath, const char *path); + +#endif -- 2.39.2