]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
regex.3: SYNOPSIS: Use 'restrict' in prototypes
authorAlejandro Colomar <alx.manpages@gmail.com>
Mon, 8 Mar 2021 18:53:29 +0000 (19:53 +0100)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Sun, 14 Mar 2021 20:29:13 +0000 (21:29 +0100)
Both POSIX and glibc use 'restrict' in regcomp(), regexec(),
regerror().
Let's use it here too.

.../glibc$ grep_glibc_prototype regcomp
posix/regex.h:644:
extern int regcomp (regex_t *_Restrict_ __preg,
    const char *_Restrict_ __pattern,
    int __cflags);
.../glibc$ grep_glibc_prototype regexec
posix/regex.h:648:
extern int regexec (const regex_t *_Restrict_ __preg,
    const char *_Restrict_ __String, size_t __nmatch,
    regmatch_t __pmatch[_Restrict_arr_],
    int __eflags);
.../glibc$ grep_glibc_prototype regerror
posix/regex.h:653:
extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
char *_Restrict_ __errbuf, size_t __errbuf_size);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man3/regex.3

index 79af42ff4d021fef5b9181c7fe10b94f3c027064..12e43b3f985c427a7bf14fbb43938852776c6d47 100644 (file)
@@ -34,13 +34,15 @@ regcomp, regexec, regerror, regfree \- POSIX regex functions
 .nf
 .B #include <regex.h>
 .PP
-.BI "int regcomp(regex_t *" preg ", const char *" regex ", int " cflags );
-.BI "int regexec(const regex_t *" preg ", const char *" string \
-", size_t " nmatch ,
-.BI "            regmatch_t " pmatch[] ", int " eflags );
+.BI "int regcomp(regex_t *restrict " preg ", const char *restrict " regex ,
+.BI "            int " cflags );
+.BI "int regexec(const regex_t *restrict " preg \
+", const char *restrict " string ,
+.BI "            size_t " nmatch ", regmatch_t " pmatch "[restrict]\
+, int " eflags );
 .PP
-.BI "size_t regerror(int " errcode ", const regex_t *" preg ", char *" errbuf ,
-.BI "            size_t " errbuf_size );
+.BI "size_t regerror(int " errcode ", const regex_t *restrict " preg ,
+.BI "            char *restrict " errbuf ", size_t " errbuf_size );
 .BI "void regfree(regex_t *" preg );
 .fi
 .SH DESCRIPTION