Skip to content

Commit 6d4e6b3

Browse files
committed
glob.c: Remove alternative dir functions as unused
1 parent a1d9905 commit 6d4e6b3

File tree

2 files changed

+2
-38
lines changed

2 files changed

+2
-38
lines changed

win32/glob.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
* GLOB_NOMAGIC:
5050
* Same as GLOB_NOCHECK, but it will only append pattern if it did
5151
* not contain any magic characters. [Used in csh style globbing]
52-
* GLOB_ALTDIRFUNC:
53-
* Use alternately specified directory access functions.
5452
* GLOB_TILDE:
5553
* expand ~user/foo to the /home/dir/of/user/foo
5654
* GLOB_BRACE:
@@ -560,14 +558,6 @@ static int glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend
560558
DIR *dirp;
561559
int err;
562560

563-
/*
564-
* The readdirfunc declaration can't be prototyped, because it is
565-
* assigned, below, to two functions which are prototyped in glob.h
566-
* and dirent.h as taking pointers to differently typed opaque
567-
* structures.
568-
*/
569-
struct dirent *(*readdirfunc)();
570-
571561
if (pathend > pathend_last)
572562
return (1);
573563
*pathend = EOS;
@@ -589,11 +579,7 @@ static int glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend
589579
err = 0;
590580

591581
/* Search directory for matching names. */
592-
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
593-
readdirfunc = pglob->gl_readdir;
594-
else
595-
readdirfunc = readdir;
596-
while ((dp = (*readdirfunc)(dirp))) {
582+
while ((dp = readdir(dirp))) {
597583
register uint8_t *sc;
598584
register Char *dc;
599585

@@ -620,10 +606,7 @@ static int glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend
620606
break;
621607
}
622608

623-
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
624-
(*pglob->gl_closedir)(dirp);
625-
else
626-
closedir(dirp);
609+
closedir(dirp);
627610
return(err);
628611
}
629612

@@ -777,9 +760,6 @@ static DIR * g_opendir(Char *str, glob_t *pglob)
777760
return(NULL);
778761
}
779762

780-
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
781-
return((*pglob->gl_opendir)(buf));
782-
783763
return(opendir(buf));
784764
}
785765

@@ -789,8 +769,6 @@ static int g_lstat(Char *fn, php_win32_ioutil_stat_t *sb, glob_t *pglob)
789769

790770
if (g_Ctoc(fn, buf, sizeof(buf)))
791771
return(-1);
792-
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
793-
return((*pglob->gl_lstat)(buf, sb));
794772
return(php_win32_ioutil_lstat(buf, sb));
795773
}
796774

@@ -800,8 +778,6 @@ static int g_stat(Char *fn, php_win32_ioutil_stat_t *sb, glob_t *pglob)
800778

801779
if (g_Ctoc(fn, buf, sizeof(buf)))
802780
return(-1);
803-
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
804-
return((*pglob->gl_stat)(buf, sb));
805781
return(php_win32_ioutil_stat(buf, sb));
806782
}
807783

win32/glob.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,6 @@ typedef struct {
5353
char **gl_pathv; /* List of paths matching pattern. */
5454
/* Copy of errfunc parameter to glob. */
5555
int (*gl_errfunc)(const char *, int);
56-
57-
/*
58-
* Alternate filesystem access methods for glob; replacement
59-
* versions of closedir(3), readdir(3), opendir(3), stat(2)
60-
* and lstat(2).
61-
*/
62-
void (*gl_closedir)(void *);
63-
struct dirent *(*gl_readdir)(void *);
64-
void *(*gl_opendir)(const char *);
65-
int (*gl_lstat)(const char *, php_win32_ioutil_stat_t *);
66-
int (*gl_stat)(const char *, php_win32_ioutil_stat_t *);
6756
} glob_t;
6857

6958
/* Flags */
@@ -73,7 +62,6 @@ typedef struct {
7362
#define GLOB_MARK 0x0008 /* Append / to matching directories. */
7463
#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
7564
#define GLOB_NOSORT 0x0020 /* Don't sort. */
76-
#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
7765
#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
7866
#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
7967
#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */

0 commit comments

Comments
 (0)