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

@ -313,7 +313,7 @@ int output_xml(void)
return 0;
}
void html_header(FILE * f)
void html_header(FILE *restrict f)
{
char outstr[200];
struct tm *tmp;
@ -387,7 +387,7 @@ void html_header(FILE * f)
fprintf(f, "<a name=\"ranges\">The lease file mtime: %s</a>", outstr);
}
void html_footer(FILE * f)
void html_footer(FILE *restrict f)
{
fprintf(f, "<p><br></p>\n");
fprintf(f, "<hr>\n");
@ -403,44 +403,44 @@ void html_footer(FILE * f)
fprintf(f, "</html>\n");
}
void newrow(FILE * f)
void newrow(FILE *restrict f)
{
fprintf(f, "<tr>\n");
}
void endrow(FILE * f)
void endrow(FILE *restrict f)
{
fprintf(f, "</tr>\n\n");
}
void output_line(FILE * f, char *type, char *class, char *text)
void output_line(FILE *restrict f, char *restrict type, char *restrict class, char *restrict text)
{
fprintf(f, " <%s class=%s>%s</%s>\n", type, class, text, type);
}
void output_long(FILE * f, char *type, unsigned long unlong)
void output_long(FILE *restrict f, char *restrict type, unsigned long unlong)
{
fprintf(f, " <%s class=ralign>%lu</%s>\n", type, unlong, type);
}
void output_float(FILE * f, char *type, float fl)
void output_float(FILE * f, char *restrict type, float fl)
{
fprintf(f, " <%s class=ralign>%.3f</%s>\n", type, fl, type);
}
void table_start(FILE * f)
void table_start(FILE *restrict f)
{
fprintf(f, "<table width=\"75%%\" ");
fprintf(f, "class=\"%s\" ", PACKAGE_NAME);
fprintf(f, "summary=\"ISC dhcpd pool usage report\">\n");
}
void table_end(FILE * f)
void table_end(FILE *restrict f)
{
fprintf(f, "</table>\n");
}
void newsection(FILE * f, char *title)
void newsection(FILE *restrict f, char *restrict title)
{
newrow(f);
output_line(f, "td", "calign", "&nbsp;");