about summary refs log tree commit diff
path: root/src/regex
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-09-06 22:44:55 -0400
committerRich Felker <dalias@aerifal.cx>2012-09-06 22:44:55 -0400
commit400c5e5c8307a2ebe44ef1f203f5a15669f20347 (patch)
tree087a48dc8251fa05f6866af8ebf96b69450b15ab /src/regex
parentbac03cdde1137c16b4c194e137310e2748661dcc (diff)
downloadmusl-400c5e5c8307a2ebe44ef1f203f5a15669f20347.tar.gz
musl-400c5e5c8307a2ebe44ef1f203f5a15669f20347.tar.xz
musl-400c5e5c8307a2ebe44ef1f203f5a15669f20347.zip
use restrict everywhere it's required by c99 and/or posix 2008
to deal with the fact that the public headers may be used with pre-c99
compilers, __restrict is used in place of restrict, and defined
appropriately for any supported compiler. we also avoid the form
[restrict] since older versions of gcc rejected it due to a bug in the
original c99 standard, and instead use the form *restrict.
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/glob.c2
-rw-r--r--src/regex/regcomp.c2
-rw-r--r--src/regex/regerror.c2
-rw-r--r--src/regex/regexec.c4
4 files changed, 5 insertions, 5 deletions
diff --git a/src/regex/glob.c b/src/regex/glob.c
index 3476e010..6c07e6b3 100644
--- a/src/regex/glob.c
+++ b/src/regex/glob.c
@@ -156,7 +156,7 @@ static int sort(const void *a, const void *b)
 	return strcmp(*(const char **)a, *(const char **)b);
 }
 
-int glob(const char *pat, int flags, int (*errfunc)(const char *path, int err), glob_t *g)
+int glob(const char *restrict pat, int flags, int (*errfunc)(const char *path, int err), glob_t *restrict g)
 {
 	const char *p=pat, *d;
 	struct match head = { .next = NULL }, *tail = &head;
diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c
index 322a5e67..399989e7 100644
--- a/src/regex/regcomp.c
+++ b/src/regex/regcomp.c
@@ -3091,7 +3091,7 @@ tre_ast_to_tnfa(tre_ast_node_t *node, tre_tnfa_transition_t *transitions,
 
 
 int
-regcomp(regex_t *preg, const char *regex, int cflags)
+regcomp(regex_t *restrict preg, const char *restrict regex, int cflags)
 {
   tre_stack_t *stack;
   tre_ast_node_t *tree, *tmp_ast_l, *tmp_ast_r;
diff --git a/src/regex/regerror.c b/src/regex/regerror.c
index 0645b8e7..df4afa4f 100644
--- a/src/regex/regerror.c
+++ b/src/regex/regerror.c
@@ -26,7 +26,7 @@ static const char messages[] = {
   "\0Unknown error"
 };
 
-size_t regerror(int e, const regex_t *preg, char *buf, size_t size)
+size_t regerror(int e, const regex_t *restrict preg, char *restrict buf, size_t size)
 {
 	const char *s;
 	for (s=messages; e && *s; e--, s+=strlen(s)+1);
diff --git a/src/regex/regexec.c b/src/regex/regexec.c
index 8107aae7..855cef57 100644
--- a/src/regex/regexec.c
+++ b/src/regex/regexec.c
@@ -977,8 +977,8 @@ tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags,
 */
 
 int
-regexec(const regex_t *preg, const char *string,
-	  size_t nmatch, regmatch_t pmatch[], int eflags)
+regexec(const regex_t *restrict preg, const char *restrict string,
+	  size_t nmatch, regmatch_t pmatch[restrict], int eflags)
 {
   tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
   reg_errcode_t status;