@@ -138,33 +138,33 @@ struct glob_lim {
138138};
139139
140140static int compare (const void * , const void * );
141- static int g_Ctoc (const Char * , char * , size_t );
142- static int g_lstat (Char * , struct stat * , glob_t * );
141+ static int g_Ctoc (const Char * restrict , char * restrict , size_t );
142+ static int g_lstat (Char * restrict , struct stat * restrict , glob_t * restrict );
143143static DIR * g_opendir (Char * , glob_t * );
144144static Char * g_strchr (const Char * , int );
145145static int g_strncmp (const Char * , const char * , size_t );
146- static int g_stat (Char * , struct stat * , glob_t * );
147- static int glob0 (const Char * , glob_t * , struct glob_lim * );
148- static int glob1 (Char * , Char * , glob_t * , struct glob_lim * );
146+ static int g_stat (Char * restrict , struct stat * restrict , glob_t * restrict );
147+ static int glob0 (const Char * restrict , glob_t * restrict , struct glob_lim * restrict );
148+ static int glob1 (Char * , Char * , glob_t * restrict , struct glob_lim * restrict );
149149static int glob2 (Char * , Char * , Char * , Char * , Char * , Char * ,
150- glob_t * , struct glob_lim * );
150+ glob_t * restrict , struct glob_lim * restrict );
151151static int glob3 (Char * , Char * , Char * , Char * , Char * ,
152- Char * , Char * , glob_t * , struct glob_lim * );
153- static int globextend (const Char * , glob_t * , struct glob_lim * ,
154- struct stat * );
152+ Char * , Char * , glob_t * restrict , struct glob_lim * restrict );
153+ static int globextend (const Char * restrict , glob_t * restrict , struct glob_lim * restrict ,
154+ struct stat * restrict );
155155static const Char *
156- globtilde (const Char * , Char * , size_t , glob_t * );
157- static int globexp1 (const Char * , glob_t * , struct glob_lim * );
158- static int globexp2 (const Char * , const Char * , glob_t * ,
159- struct glob_lim * );
156+ globtilde (const Char * restrict , Char * restrict , size_t , glob_t * restrict );
157+ static int globexp1 (const Char * restrict , glob_t * restrict , struct glob_lim * restrict );
158+ static int globexp2 (const Char * , const Char * , glob_t * restrict ,
159+ struct glob_lim * restrict );
160160static int match (Char * , Char * , Char * );
161161#ifdef DEBUG
162- static void qprintf (const char * , Char * );
162+ static void qprintf (const char * restrict , Char * restrict );
163163#endif
164164
165165int
166- sudo_glob (const char * pattern , int flags , int (* errfunc )(const char * , int ),
167- glob_t * pglob )
166+ sudo_glob (const char * restrict pattern , int flags , int (* errfunc )(const char * , int ),
167+ glob_t * restrict pglob )
168168{
169169 const unsigned char * patnext ;
170170 int c ;
@@ -220,7 +220,7 @@ sudo_glob(const char *pattern, int flags, int (*errfunc)(const char *, int),
220220 * characters
221221 */
222222static int
223- globexp1 (const Char * pattern , glob_t * pglob , struct glob_lim * limitp )
223+ globexp1 (const Char * restrict pattern , glob_t * restrict pglob , struct glob_lim * restrict limitp )
224224{
225225 const Char * ptr = pattern ;
226226
@@ -241,10 +241,11 @@ globexp1(const Char *pattern, glob_t *pglob, struct glob_lim *limitp)
241241 * If it fails then it tries to glob the rest of the pattern and returns.
242242 */
243243static int
244- globexp2 (const Char * ptr , const Char * pattern , glob_t * pglob ,
245- struct glob_lim * limitp )
244+ globexp2 (const Char * ptr , const Char * pattern , glob_t * restrict pglob ,
245+ struct glob_lim * restrict limitp )
246246{
247- int i , rv ;
247+ size_t i ;
248+ int rv ;
248249 Char * lm , * ls ;
249250 const Char * pe , * pm , * pl ;
250251 Char patbuf [PATH_MAX ];
@@ -346,7 +347,7 @@ globexp2(const Char *ptr, const Char *pattern, glob_t *pglob,
346347 * expand tilde from the passwd file.
347348 */
348349static const Char *
349- globtilde (const Char * pattern , Char * patbuf , size_t patbuf_len , glob_t * pglob )
350+ globtilde (const Char * restrict pattern , Char * restrict patbuf , size_t patbuf_len , glob_t * restrict pglob )
350351{
351352 struct passwd * pwd ;
352353 char * h ;
@@ -413,7 +414,7 @@ g_strncmp(const Char *s1, const char *s2, size_t n)
413414}
414415
415416static int
416- g_charclass (const Char * * patternp , Char * * bufnextp )
417+ g_charclass (const Char * * restrict patternp , Char * * restrict bufnextp )
417418{
418419 const Char * pattern = * patternp + 1 ;
419420 Char * bufnext = * bufnextp ;
@@ -447,7 +448,7 @@ g_charclass(const Char **patternp, Char **bufnextp)
447448 * to find no matches.
448449 */
449450static int
450- glob0 (const Char * pattern , glob_t * pglob , struct glob_lim * limitp )
451+ glob0 (const Char * restrict pattern , glob_t * restrict pglob , struct glob_lim * restrict limitp )
451452{
452453 const Char * qpatnext ;
453454 int c , err ;
@@ -551,7 +552,7 @@ compare(const void *p, const void *q)
551552}
552553
553554static int
554- glob1 (Char * pattern , Char * pattern_last , glob_t * pglob , struct glob_lim * limitp )
555+ glob1 (Char * pattern , Char * pattern_last , glob_t * restrict pglob , struct glob_lim * restrict limitp )
555556{
556557 Char pathbuf [PATH_MAX ];
557558
@@ -570,7 +571,7 @@ glob1(Char *pattern, Char *pattern_last, glob_t *pglob, struct glob_lim *limitp)
570571 */
571572static int
572573glob2 (Char * pathbuf , Char * pathbuf_last , Char * pathend , Char * pathend_last ,
573- Char * pattern , Char * pattern_last , glob_t * pglob , struct glob_lim * limitp )
574+ Char * pattern , Char * pattern_last , glob_t * restrict pglob , struct glob_lim * restrict limitp )
574575{
575576 struct stat sb ;
576577 Char * p , * q ;
@@ -638,8 +639,8 @@ glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
638639
639640static int
640641glob3 (Char * pathbuf , Char * pathbuf_last , Char * pathend , Char * pathend_last ,
641- Char * pattern , Char * restpattern , Char * restpattern_last , glob_t * pglob ,
642- struct glob_lim * limitp )
642+ Char * pattern , Char * restpattern , Char * restpattern_last , glob_t * restrict pglob ,
643+ struct glob_lim * restrict limitp )
643644{
644645 struct dirent * dp ;
645646 DIR * dirp ;
@@ -721,8 +722,8 @@ glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
721722 * gl_pathv points to (gl_offs + gl_pathc + 1) items.
722723 */
723724static int
724- globextend (const Char * path , glob_t * pglob , struct glob_lim * limitp ,
725- struct stat * sb )
725+ globextend (const Char * restrict path , glob_t * restrict pglob , struct glob_lim * restrict limitp ,
726+ struct stat * restrict sb )
726727{
727728 char * * pathv ;
728729 size_t i , newn , len ;
@@ -892,7 +893,7 @@ g_opendir(Char *str, glob_t *pglob)
892893}
893894
894895static int
895- g_lstat (Char * fn , struct stat * sb , glob_t * pglob )
896+ g_lstat (Char * restrict fn , struct stat * restrict sb , glob_t * restrict pglob )
896897{
897898 char buf [PATH_MAX ];
898899
@@ -902,7 +903,7 @@ g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
902903}
903904
904905static int
905- g_stat (Char * fn , struct stat * sb , glob_t * pglob )
906+ g_stat (Char * restrict fn , struct stat * restrict sb , glob_t * restrict pglob )
906907{
907908 char buf [PATH_MAX ];
908909
@@ -922,7 +923,7 @@ g_strchr(const Char *str, int ch)
922923}
923924
924925static int
925- g_Ctoc (const Char * str , char * buf , size_t len )
926+ g_Ctoc (const Char * restrict str , char * restrict buf , size_t len )
926927{
927928
928929 while (len -- ) {
@@ -934,7 +935,7 @@ g_Ctoc(const Char *str, char *buf, size_t len)
934935
935936#ifdef DEBUG
936937static void
937- qprintf (const char * str , Char * s )
938+ qprintf (const char * restrict str , Char * restrict s )
938939{
939940 Char * p ;
940941
0 commit comments