all files: use restrict key word for all pointer arguments

Limit the effects of pointer aliasing and aiding caching
optimizations.

http://cellperformance.beyond3d.com/articles/2006/05/demystifying-the-restrict-keyword.html

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2011-10-23 22:18:38 +02:00
parent 235825b084
commit 6b47d9ffaf
6 changed files with 33 additions and 32 deletions

View file

@ -198,7 +198,7 @@ int parse_leases(void)
* first field is 1 and not 0 like C programs should have. Question of
* semantics, send mail to author if this annoys. All performance boosts for
* this function are well come. */
int nth_field(int n, char *dest, const char *src)
int nth_field(int n, char *restrict dest, const char *restrict src)
{
int i, j = 0, wordn = 0, len;
@ -225,7 +225,7 @@ int nth_field(int n, char *dest, const char *src)
}
/* dhcpd.conf interesting words */
int is_interesting_config_clause(char *s)
int is_interesting_config_clause(char *restrict s)
{
if (strstr(s, "range")) {
return 3;
@ -239,8 +239,8 @@ int is_interesting_config_clause(char *s)
}
/* FIXME: This spagetti monster function need to be rewrote at least ones. */
void parse_config(int is_include, char *config_file,
struct shared_network_t *shared_p)
void parse_config(int is_include, const char *restrict config_file,
struct shared_network_t *restrict shared_p)
{
FILE *dhcpd_config;
int newclause = true, argument = false, comment =