2013-11-20 Chirayu Desai <chirayudesai1@gmail.com>

* libc/include/regex.h, libc/posix/regcomp.c,
	libc/posix/regerror.c, libc/posix/regex.3
	libc/posix/regexec.c: Add restrict keyword.
This commit is contained in:
Joel Sherrill 2013-11-20 16:25:50 +00:00
parent a2c4eac5d0
commit ea9d80921f
6 changed files with 27 additions and 19 deletions

View File

@ -1,3 +1,9 @@
2013-11-20 Chirayu Desai <chirayudesai1@gmail.com>
* libc/include/regex.h, libc/posix/regcomp.c,
libc/posix/regerror.c, libc/posix/regex.3
libc/posix/regexec.c: Add restrict keyword.
2013-11-20 Daniel Ramirez <javamonn@gmail.com> 2013-11-20 Daniel Ramirez <javamonn@gmail.com>
* libc/iconv/lib/iconv.c, libc/include/iconv.h, * libc/iconv/lib/iconv.c, libc/include/iconv.h,

View File

@ -93,9 +93,10 @@ typedef struct {
#define REG_BACKR 02000 /* force use of backref code */ #define REG_BACKR 02000 /* force use of backref code */
__BEGIN_DECLS __BEGIN_DECLS
int regcomp(regex_t *, const char *, int); int regcomp(regex_t *__restrict, const char *__restrict, int);
size_t regerror(int, const regex_t *, char *, size_t); size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t);
int regexec(const regex_t *, const char *, size_t, regmatch_t [], int); int regexec(const regex_t *__restrict, const char *__restrict,
size_t, regmatch_t [__restrict], int);
void regfree(regex_t *); void regfree(regex_t *);
__END_DECLS __END_DECLS

View File

@ -174,7 +174,7 @@ static int never = 0; /* for use in asserts; shuts lint up */
/* /*
- regcomp - interface for parser and compilation - regcomp - interface for parser and compilation
= extern int regcomp(regex_t *, const char *, int); = extern int regcomp(regex_t *__restrict, const char *__restrict, int);
= #define REG_BASIC 0000 = #define REG_BASIC 0000
= #define REG_EXTENDED 0001 = #define REG_EXTENDED 0001
= #define REG_ICASE 0002 = #define REG_ICASE 0002
@ -186,8 +186,8 @@ static int never = 0; /* for use in asserts; shuts lint up */
*/ */
int /* 0 success, otherwise REG_something */ int /* 0 success, otherwise REG_something */
regcomp(preg, pattern, cflags) regcomp(preg, pattern, cflags)
regex_t *preg; regex_t *__restrict preg;
const char *pattern; const char *__restrict pattern;
int cflags; int cflags;
{ {
struct parse pa; struct parse pa;

View File

@ -107,14 +107,15 @@ static struct rerr {
/* /*
- regerror - the interface to error numbers - regerror - the interface to error numbers
= extern size_t regerror(int, const regex_t *, char *, size_t); = extern size_t regerror(int, const regex_t *__restrict,
= char *__restrict, size_t);
*/ */
/* ARGSUSED */ /* ARGSUSED */
size_t size_t
regerror(errcode, preg, errbuf, errbuf_size) regerror(errcode, preg, errbuf, errbuf_size)
int errcode; int errcode;
const regex_t *preg; const regex_t *__restrict preg;
char *errbuf; char *__restrict errbuf;
size_t errbuf_size; size_t errbuf_size;
{ {
struct rerr *r; struct rerr *r;

View File

@ -51,16 +51,16 @@
.In sys/types.h .In sys/types.h
.In regex.h .In regex.h
.Ft int .Ft int
.Fn regcomp "regex_t *preg" "const char *pattern" "int cflags" .Fn regcomp "regex_t *restrict preg" "const char *_restrictpattern" "int cflags"
.Ft int .Ft int
.Fo regexec .Fo regexec
.Fa "const regex_t *preg" "const char *string" .Fa "const regex_t *_restrict preg" "const char *_restrict string"
.Fa "size_t nmatch" "regmatch_t pmatch[]" "int eflags" .Fa "size_t nmatch" "regmatch_t pmatch[_restrict]" "int eflags"
.Fc .Fc
.Ft size_t .Ft size_t
.Fo regerror .Fo regerror
.Fa "int errcode" "const regex_t *preg" .Fa "int errcode" "const regex_t *_restrict preg"
.Fa "char *errbuf" "size_t errbuf_size" .Fa "char *_restrict errbuf" "size_t errbuf_size"
.Fc .Fc
.Ft void .Ft void
.Fn regfree "regex_t *preg" .Fn regfree "regex_t *preg"

View File

@ -140,8 +140,8 @@ static int nope = 0; /* for use in asserts; shuts lint up */
/* /*
- regexec - interface for matching - regexec - interface for matching
= extern int regexec(const regex_t *, const char *, size_t, \ = extern int regexec(const regex_t *__restrict, const char *__restrict,
= regmatch_t [], int); = size_t, regmatch_t [__restrict], int);
= #define REG_NOTBOL 00001 = #define REG_NOTBOL 00001
= #define REG_NOTEOL 00002 = #define REG_NOTEOL 00002
= #define REG_STARTEND 00004 = #define REG_STARTEND 00004
@ -155,10 +155,10 @@ static int nope = 0; /* for use in asserts; shuts lint up */
*/ */
int /* 0 success, REG_NOMATCH failure */ int /* 0 success, REG_NOMATCH failure */
regexec(preg, string, nmatch, pmatch, eflags) regexec(preg, string, nmatch, pmatch, eflags)
const regex_t *preg; const regex_t *__restrict preg;
const char *string; const char *__restrict string;
size_t nmatch; size_t nmatch;
regmatch_t pmatch[]; regmatch_t pmatch[__restrict];
int eflags; int eflags;
{ {
struct re_guts *g = preg->re_g; struct re_guts *g = preg->re_g;