static int glob1(Char *, Char *, glob_t *, size_t *);
static int glob2(Char *, Char *, Char *, Char *, Char *, Char *,
glob_t *, size_t *);
-static int glob3(Char *, Char *, Char *, Char *, Char *, Char *,
+static int glob3(Char *, Char *, Char *, Char *, Char *,
Char *, Char *, glob_t *, size_t *);
static int globextend(const Char *, glob_t *, size_t *);
static const Char *
{
Char pathbuf[MAXPATHLEN];
+ assert(pattern < pattern_last);
+
/* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
if (*pattern == BG_EOS)
return(0);
Char *p, *q;
int anymeta;
+ assert(pattern < pattern_last);
+
/*
* Loop over pattern segments until end of pattern or until
* segment with meta character found.
&& *p != BG_SEP2
#endif
) {
+ assert(p < pattern_last);
if (ismeta(*p))
anymeta = 1;
if (q+1 > pathend_last)
|| *pattern == BG_SEP2
#endif
) {
+ assert(p < pattern_last);
if (pathend+1 > pathend_last)
return (1);
*pathend++ = *pattern++;
} else
/* Need expansion, recurse. */
return(glob3(pathbuf, pathbuf_last, pathend,
- pathend_last, pattern, pattern_last,
+ pathend_last, pattern,
p, pattern_last, pglob, limitp));
}
/* NOTREACHED */
static int
glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
- Char *pattern, Char *pattern_last,
+ Char *pattern,
Char *restpattern, Char *restpattern_last, glob_t *pglob, size_t *limitp)
{
Direntry_t *dp;
int nocase;
char buf[MAXPATHLEN];
+ assert(pattern < restpattern_last);
+ assert(restpattern < restpattern_last);
+
/*
* The readdirfunc declaration can't be prototyped, because it is
* assigned, below, to two functions which are prototyped in glob.h
pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
if ((pglob->gl_flags & GLOB_LIMIT) &&
- newsize + *limitp >= ARG_MAX) {
+ newsize + *limitp >= (unsigned long)ARG_MAX) {
errno = 0;
return(GLOB_NOSPACE);
}