From 400c5e5c8307a2ebe44ef1f203f5a15669f20347 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 6 Sep 2012 22:44:55 -0400 Subject: 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. --- src/regex/glob.c | 2 +- src/regex/regcomp.c | 2 +- src/regex/regerror.c | 2 +- src/regex/regexec.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/regex') 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; -- cgit v1.2.1