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.
This commit is contained in:
parent
bac03cdde1
commit
400c5e5c83
192 changed files with 552 additions and 382 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue