]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
scandir.3: SYNOPSIS: Use 'restrict' in prototypes
authorAlejandro Colomar <alx.manpages@gmail.com>
Mon, 8 Mar 2021 18:53:31 +0000 (19:53 +0100)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Sun, 14 Mar 2021 20:29:13 +0000 (21:29 +0100)
POSIX does NOT specify scandir() to use 'restrict'.
However, glibc uses 'restrict'.
Users might be surprised by this!  Let's use it here too!

.../glibc$ grep_glibc_prototype scandir
dirent/dirent.h:255:
extern int scandir (const char *__restrict __dir,
    struct dirent ***__restrict __namelist,
    int (*__selector) (const struct dirent *),
    int (*__cmp) (const struct dirent **,
  const struct dirent **))
     __nonnull ((1, 2));
.../glibc$

Cc: glibc <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man3/scandir.3

index 83a5eea7d2eda0d7f8019591319dcb435d970eaf..262e125c16de1a285a331ab5e14498af7a1d3254 100644 (file)
@@ -67,7 +67,7 @@ a directory for matching entries
 .nf
 .B #include <dirent.h>
 .PP
-.BI "int scandir(const char *" dirp ", struct dirent ***" namelist ,
+.BI "int scandir(const char *restrict " dirp ", struct dirent ***restrict " namelist ,
 .BI "            int (*" filter ")(const struct dirent *),"
 .BI "            int (*" compar ")(const struct dirent **,"
 .BR "                          const struct dirent **));"