mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
performance: add few restict and const key words
This should make the run to be couple percentages quicker. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
dbf3927c39
commit
b61c93b7a1
3 changed files with 5 additions and 5 deletions
|
|
@ -42,7 +42,7 @@
|
|||
#include "dhcpd-pools.h"
|
||||
|
||||
/* Clean up data */
|
||||
static int ip_sort(struct leases_t *a, struct leases_t *b)
|
||||
static int ip_sort(const struct leases_t *restrict a, const struct leases_t *restrict b)
|
||||
{
|
||||
if (a->ip < b->ip)
|
||||
return -1;
|
||||
|
|
@ -61,8 +61,8 @@ int prepare_data(void)
|
|||
/* Join leases and ranges into couter structs */
|
||||
int do_counting(void)
|
||||
{
|
||||
struct range_t *range_p;
|
||||
struct leases_t *l;
|
||||
struct range_t *restrict range_p;
|
||||
const struct leases_t *restrict l;
|
||||
unsigned long i, k, block_size;
|
||||
|
||||
range_p = ranges;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ int do_counting(void);
|
|||
void flip_ranges(struct range_t *__restrict ranges, struct range_t *__restrict tmp_ranges)
|
||||
__attribute__ ((nonnull(1, 2)));
|
||||
/* support functions */
|
||||
int xstrstr(char *__restrict a, const char *__restrict b, int len);
|
||||
int xstrstr(const char *__restrict a, const char *__restrict b, int len);
|
||||
double strtod_or_err(const char *__restrict str, const char *__restrict errmesg);
|
||||
void print_version(void) __attribute__ ((noreturn));
|
||||
void usage(int status) __attribute__ ((noreturn));
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ int
|
|||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
|
||||
__attribute__ ((hot))
|
||||
#endif
|
||||
xstrstr(char *restrict a, const char *restrict b, int len)
|
||||
xstrstr(const char *restrict a, const char *restrict b, const int len)
|
||||
{
|
||||
int i;
|
||||
/* two spaces are very common in lease file, after them
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue