Skip to content

Commit 892927e

Browse files
committed
Use proper function prototypes in win32/glob.c
This just confused the hell out of me
1 parent 265c88b commit 892927e

File tree

1 file changed

+19
-77
lines changed

1 file changed

+19
-77
lines changed

win32/glob.c

Lines changed: 19 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,7 @@ static int match(Char *, Char *, Char *);
157157
static void qprintf(const char *, Char *);
158158
#endif
159159

160-
PHPAPI int
161-
glob(pattern, flags, errfunc, pglob)
162-
const char *pattern;
163-
int flags, (*errfunc)(const char *, int);
164-
glob_t *pglob;
160+
PHPAPI int glob(const char *pattern, int flags, (*errfunc)(const char *, int), glob_t *pglob)
165161
{
166162
const u_char *patnext;
167163
int c;
@@ -215,10 +211,7 @@ glob(pattern, flags, errfunc, pglob)
215211
* invoke the standard globbing routine to glob the rest of the magic
216212
* characters
217213
*/
218-
static int
219-
globexp1(pattern, pglob)
220-
const Char *pattern;
221-
glob_t *pglob;
214+
static int globexp1(const Char *pattern,glob_t *pglob)
222215
{
223216
const Char* ptr = pattern;
224217
int rv;
@@ -240,11 +233,7 @@ globexp1(pattern, pglob)
240233
* If it succeeds then it invokes globexp1 with the new pattern.
241234
* If it fails then it tries to glob the rest of the pattern and returns.
242235
*/
243-
static int
244-
globexp2(ptr, pattern, pglob, rv)
245-
const Char *ptr, *pattern;
246-
glob_t *pglob;
247-
int *rv;
236+
static int globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv)
248237
{
249238
int i;
250239
Char *lm, *ls;
@@ -350,12 +339,7 @@ globexp2(ptr, pattern, pglob, rv)
350339
/*
351340
* expand tilde from the passwd file.
352341
*/
353-
static const Char *
354-
globtilde(pattern, patbuf, patbuf_len, pglob)
355-
const Char *pattern;
356-
Char *patbuf;
357-
size_t patbuf_len;
358-
glob_t *pglob;
342+
static const Char *globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
359343
{
360344
#ifndef PHP_WIN32
361345
struct passwd *pwd;
@@ -429,10 +413,7 @@ globtilde(pattern, patbuf, patbuf_len, pglob)
429413
* if things went well, nonzero if errors occurred. It is not an error
430414
* to find no matches.
431415
*/
432-
static int
433-
glob0(pattern, pglob)
434-
const Char *pattern;
435-
glob_t *pglob;
416+
static int glob0( const Char *pattern, glob_t *pglob)
436417
{
437418
const Char *qpatnext;
438419
int c, err, oldpathc;
@@ -518,8 +499,7 @@ glob0(pattern, pglob)
518499
return(0);
519500
}
520501

521-
static int
522-
compare(const void *p, const void *q)
502+
static int compare(const void *p, const void *q)
523503
{
524504
return(strcmp(*(char **)p, *(char **)q));
525505
}
@@ -545,13 +525,8 @@ glob1(pattern, pattern_last, pglob, limitp)
545525
* of recursion for each segment in the pattern that contains one or more
546526
* meta characters.
547527
*/
548-
static int
549-
glob2(pathbuf, pathbuf_last, pathend, pathend_last, pattern,
550-
pattern_last, pglob, limitp)
551-
Char *pathbuf, *pathbuf_last, *pathend, *pathend_last;
552-
Char *pattern, *pattern_last;
553-
glob_t *pglob;
554-
size_t *limitp;
528+
static int glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last, pattern,
529+
Char *pattern_last, glob_t *pglob, size_t *limitp)
555530
{
556531
zend_stat_t sb = {0};
557532
Char *p, *q;
@@ -609,13 +584,8 @@ glob2(pathbuf, pathbuf_last, pathend, pathend_last, pattern,
609584
/* NOTREACHED */
610585
}
611586

612-
static int
613-
glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last,
614-
restpattern, restpattern_last, pglob, limitp)
615-
Char *pathbuf, *pathbuf_last, *pathend, *pathend_last;
616-
Char *pattern, *pattern_last, *restpattern, *restpattern_last;
617-
glob_t *pglob;
618-
size_t *limitp;
587+
static int glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last, Char *pattern, Char *pattern_last,
588+
Char *restpattern, Char *restpattern_last, glob_t *pglob, size_t *limitp)
619589
{
620590
register struct dirent *dp;
621591
DIR *dirp;
@@ -703,11 +673,7 @@ glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last,
703673
* Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
704674
* gl_pathv points to (gl_offs + gl_pathc + 1) items.
705675
*/
706-
static int
707-
globextend(path, pglob, limitp)
708-
const Char *path;
709-
glob_t *pglob;
710-
size_t *limitp;
676+
static int globextend(const Char *path, glob_t *pglob, size_t *limitp)
711677
{
712678
register char **pathv;
713679
u_int newsize, len;
@@ -761,9 +727,7 @@ globextend(path, pglob, limitp)
761727
* pattern matching function for filenames. Each occurrence of the *
762728
* pattern causes a recursion level.
763729
*/
764-
static int
765-
match(name, pat, patend)
766-
register Char *name, *pat, *patend;
730+
static int match(Char *name, Char *pat, Char *patend)
767731
{
768732
int ok, negate_range;
769733
Char c, k;
@@ -810,9 +774,7 @@ match(name, pat, patend)
810774
}
811775

812776
/* Free allocated data belonging to a glob_t structure. */
813-
PHPAPI void
814-
globfree(pglob)
815-
glob_t *pglob;
777+
PHPAPI void globfree(glob_t *pglob)
816778
{
817779
register int i;
818780
register char **pp;
@@ -827,10 +789,7 @@ globfree(pglob)
827789
}
828790
}
829791

830-
static DIR *
831-
g_opendir(str, pglob)
832-
register Char *str;
833-
glob_t *pglob;
792+
static DIR * g_opendir(Char *str, glob_t *pglob)
834793
{
835794
char buf[MAXPATHLEN];
836795

@@ -847,11 +806,7 @@ g_opendir(str, pglob)
847806
return(opendir(buf));
848807
}
849808

850-
static int
851-
g_lstat(fn, sb, pglob)
852-
register Char *fn;
853-
zend_stat_t *sb = NULL;
854-
glob_t *pglob;
809+
static int g_lstat(Char *fn, zend_stat_t *sb, glob_t *pglob)
855810
{
856811
char buf[MAXPATHLEN];
857812

@@ -862,11 +817,7 @@ g_lstat(fn, sb, pglob)
862817
return(php_sys_lstat(buf, sb));
863818
}
864819

865-
static int
866-
g_stat(fn, sb, pglob)
867-
register Char *fn;
868-
zend_stat_t *sb = NULL;
869-
glob_t *pglob;
820+
static int g_stat(Char *fn, zend_stat_t *sb, glob_t *pglob)
870821
{
871822
char buf[MAXPATHLEN];
872823

@@ -877,10 +828,7 @@ g_stat(fn, sb, pglob)
877828
return(php_sys_stat(buf, sb));
878829
}
879830

880-
static Char *
881-
g_strchr(str, ch)
882-
Char *str;
883-
int ch;
831+
static Char *g_strchr(Char *str, int ch)
884832
{
885833
do {
886834
if (*str == ch)
@@ -889,11 +837,7 @@ g_strchr(str, ch)
889837
return (NULL);
890838
}
891839

892-
static int
893-
g_Ctoc(str, buf, len)
894-
register const Char *str;
895-
char *buf;
896-
u_int len;
840+
static int g_Ctoc(const Char *str, char *buf, u_int len)
897841
{
898842

899843
while (len--) {
@@ -905,9 +849,7 @@ g_Ctoc(str, buf, len)
905849

906850
#ifdef DEBUG
907851
static void
908-
qprintf(str, s)
909-
const char *str;
910-
register Char *s;
852+
qprintf(char *str, Char *s)
911853
{
912854
register Char *p;
913855

0 commit comments

Comments
 (0)