misc/161958: Add keyword restrict to glob().

Henning Petersen henning.petersen at t-online.de
Mon Oct 24 09:10:01 UTC 2011


>Number:         161958
>Category:       misc
>Synopsis:       Add keyword restrict to glob().
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 24 09:10:01 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Henning Petersen
>Release:        FreeBSD-current
>Organization:
>Environment:
>Description:
Add keyword restrict to glob().
>How-To-Repeat:

>Fix:
diff -u -r1.28 glob.c
--- lib/libc/gen/glob.c	12 May 2010 17:44:00 -0000	1.28
+++ lib/libc/gen/glob.c	24 Oct 2011 06:33:08 -0000
@@ -163,7 +163,8 @@
 #endif
 
 int
-glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
+glob(const char * __restrict pattern, int flags,
+	 int (*errfunc)(const char *, int), glob_t * __restrict pglob)
 {
 	const char *patnext;
 	size_t limit;
@@ -717,7 +718,7 @@
 			free(pglob->gl_pathv);
 			pglob->gl_pathv = NULL;
 		}
-		return(GLOB_NOSPACE);
+		return (GLOB_NOSPACE);
 	}
 
 	if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {


===============================================================================
diff -u -r1.11 glob.h
--- include/glob.h	16 Feb 2010 19:39:50 -0000	1.11
+++ include/glob.h	24 Oct 2011 05:48:35 -0000
@@ -98,7 +98,8 @@
 #endif /* __BSD_VISIBLE */
 
 __BEGIN_DECLS
-int	glob(const char *, int, int (*)(const char *, int), glob_t *);
+int	glob(const char * __restrict, int,
+	int (*)(const char *, int), glob_t * __restrict);
 void	globfree(glob_t *);
 __END_DECLS
 
================================================================================
diff -u -r1.34 glob.3
--- lib/libc/gen/glob.3	15 Feb 2011 20:07:35 -0000	1.34
+++ lib/libc/gen/glob.3	24 Oct 2011 05:50:17 -0000
@@ -42,7 +42,7 @@
 .Sh SYNOPSIS
 .In glob.h
 .Ft int
-.Fn glob "const char *pattern" "int flags" "int (*errfunc)(const char *, int)" "glob_t *pglob"
+.Fn glob "const char * restrict pattern" "int flags" "int (*errfunc)(const char *, int)" "glob_t * restrict pglob"
 .Ft void
 .Fn globfree "glob_t *pglob"
 .Sh DESCRIPTION




Patch attached with submission follows:

diff -u -r1.28 glob.c
--- lib/libc/gen/glob.c	12 May 2010 17:44:00 -0000	1.28
+++ lib/libc/gen/glob.c	24 Oct 2011 06:33:08 -0000
@@ -163,7 +163,8 @@
 #endif
 
 int
-glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
+glob(const char * __restrict pattern, int flags,
+	 int (*errfunc)(const char *, int), glob_t * __restrict pglob)
 {
 	const char *patnext;
 	size_t limit;
@@ -717,7 +718,7 @@
 			free(pglob->gl_pathv);
 			pglob->gl_pathv = NULL;
 		}
-		return(GLOB_NOSPACE);
+		return (GLOB_NOSPACE);
 	}
 
 	if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {


===============================================================================
diff -u -r1.11 glob.h
--- include/glob.h	16 Feb 2010 19:39:50 -0000	1.11
+++ include/glob.h	24 Oct 2011 05:48:35 -0000
@@ -98,7 +98,8 @@
 #endif /* __BSD_VISIBLE */
 
 __BEGIN_DECLS
-int	glob(const char *, int, int (*)(const char *, int), glob_t *);
+int	glob(const char * __restrict, int,
+	int (*)(const char *, int), glob_t * __restrict);
 void	globfree(glob_t *);
 __END_DECLS
 
================================================================================
diff -u -r1.34 glob.3
--- lib/libc/gen/glob.3	15 Feb 2011 20:07:35 -0000	1.34
+++ lib/libc/gen/glob.3	24 Oct 2011 05:50:17 -0000
@@ -42,7 +42,7 @@
 .Sh SYNOPSIS
 .In glob.h
 .Ft int
-.Fn glob "const char *pattern" "int flags" "int (*errfunc)(const char *, int)" "glob_t *pglob"
+.Fn glob "const char * restrict pattern" "int flags" "int (*errfunc)(const char *, int)" "glob_t * restrict pglob"
 .Ft void
 .Fn globfree "glob_t *pglob"
 .Sh DESCRIPTION




>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list