Use restrict on pointers where it makes sense. (requires C99 support,
which we already assume)
This commit is contained in:
+7
-7
@@ -106,7 +106,7 @@ char *uc_dstr_put(struct DStr *str, size_t len)
|
||||
return start;
|
||||
}
|
||||
|
||||
size_t uc_dstr_put_str_filter(struct DStr *str, const char *s, int (*is_x)(int c))
|
||||
size_t uc_dstr_put_str_filter(struct DStr *str, const char *restrict s, int (*is_x)(int c))
|
||||
{
|
||||
size_t len = strlen(s);
|
||||
size_t i;
|
||||
@@ -128,7 +128,7 @@ size_t uc_dstr_put_str_filter(struct DStr *str, const char *s, int (*is_x)(int c
|
||||
return idx;
|
||||
}
|
||||
|
||||
int uc_dstr_put_str_sz(struct DStr *str, const char *s, size_t len)
|
||||
int uc_dstr_put_str_sz(struct DStr *str, const char *restrict s, size_t len)
|
||||
{
|
||||
char *start = uc_dstr_put(str, len);
|
||||
|
||||
@@ -140,7 +140,7 @@ int uc_dstr_put_str_sz(struct DStr *str, const char *s, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uc_dstr_put_str(struct DStr *str, const char *s)
|
||||
int uc_dstr_put_str(struct DStr *str, const char *restrict s)
|
||||
{
|
||||
size_t len = strlen(s);
|
||||
|
||||
@@ -159,7 +159,7 @@ int uc_dstr_put_char(struct DStr *str, char c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uc_dstr_own(struct DStr *str, char *s)
|
||||
void uc_dstr_own(struct DStr *str, char *restrict s)
|
||||
{
|
||||
size_t len = strlen(s);
|
||||
|
||||
@@ -181,7 +181,7 @@ char *uc_dstr_steal(struct DStr *str)
|
||||
return s;
|
||||
}
|
||||
|
||||
void uc_str_swap(struct DStr *a, struct DStr *b)
|
||||
void uc_str_swap(struct DStr *restrict a, struct DStr *restrict b)
|
||||
{
|
||||
struct DStr tmp;
|
||||
|
||||
@@ -236,7 +236,7 @@ void uc_dstr_trim(struct DStr *str)
|
||||
}
|
||||
}
|
||||
|
||||
int uc_dstr_sprintf(struct DStr *str, const char *fmt, ...)
|
||||
int uc_dstr_sprintf(struct DStr *str, const char *restrict fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int rc;
|
||||
@@ -248,7 +248,7 @@ int uc_dstr_sprintf(struct DStr *str, const char *fmt, ...)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int uc_dstr_vsprintf(struct DStr *str, const char *fmt, va_list ap_)
|
||||
int uc_dstr_vsprintf(struct DStr *str, const char *restrict fmt, va_list ap_)
|
||||
{
|
||||
va_list ap;
|
||||
int rc;
|
||||
|
||||
Reference in New Issue
Block a user