1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 03:55:04 +03:00

tests: Add fallback for glob()

Fix build on platforms without glob().
This commit is contained in:
Nick Wellnhofer 2024-08-19 17:58:47 +02:00
parent 567f612d29
commit 2abb903344
2 changed files with 56 additions and 4 deletions

View File

@ -209,9 +209,35 @@ static void globfree(glob_t *pglob) {
}
}
#else
#elif HAVE_DECL_GLOB
#include <glob.h>
#endif
#else /* _WIN32, HAVE_DECL_GLOB */
#define GLOB_DOOFFS 0
typedef struct {
size_t gl_pathc; /* Count of paths matched so far */
char **gl_pathv; /* List of matched pathnames. */
size_t gl_offs; /* Slots to reserve in 'gl_pathv'. */
} glob_t;
static int
glob(const char *pattern ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED,
int errfunc(const char *epath, int eerrno) ATTRIBUTE_UNUSED,
glob_t *pglob) {
pglob->gl_pathc = 0;
pglob->gl_pathv = NULL;
return(0);
}
static void
globfree(glob_t *pglob ATTRIBUTE_UNUSED) {
}
#endif /* _WIN32, HAVE_DECL_GLOB */
/************************************************************************
* *

View File

@ -145,9 +145,35 @@ static void globfree(glob_t *pglob) {
}
}
#else
#elif HAVE_DECL_GLOB
#include <glob.h>
#endif
#else /* _WIN32, HAVE_DECL_GLOB */
#define GLOB_DOOFFS 0
typedef struct {
size_t gl_pathc; /* Count of paths matched so far */
char **gl_pathv; /* List of matched pathnames. */
size_t gl_offs; /* Slots to reserve in 'gl_pathv'. */
} glob_t;
static int
glob(const char *pattern ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED,
int errfunc(const char *epath, int eerrno) ATTRIBUTE_UNUSED,
glob_t *pglob) {
pglob->gl_pathc = 0;
pglob->gl_pathv = NULL;
return(0);
}
static void
globfree(glob_t *pglob ATTRIBUTE_UNUSED) {
}
#endif /* _WIN32, HAVE_DECL_GLOB */
/************************************************************************
* *