mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-02 07:15:44 +00:00
Allocate hash buckets in clumps. Fix a bug in a call to rc_register.
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: alloc.c,v 1.47 2000/05/16 23:02:08 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: alloc.c,v 1.48 2000/06/24 06:16:28 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -192,12 +192,27 @@ struct hash_table *new_hash_table (count, file, line)
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct hash_bucket *free_hash_buckets;
|
||||||
|
|
||||||
struct hash_bucket *new_hash_bucket (file, line)
|
struct hash_bucket *new_hash_bucket (file, line)
|
||||||
const char *file;
|
const char *file;
|
||||||
int line;
|
int line;
|
||||||
{
|
{
|
||||||
struct hash_bucket *rval = dmalloc (sizeof (struct hash_bucket),
|
struct hash_bucket *rval;
|
||||||
file, line);
|
int i;
|
||||||
|
if (!free_hash_buckets) {
|
||||||
|
rval = dmalloc (127 * sizeof (struct hash_bucket),
|
||||||
|
file, line);
|
||||||
|
if (!rval)
|
||||||
|
return rval;
|
||||||
|
for (i = 0; i < 127; i++) {
|
||||||
|
rval -> next = free_hash_buckets;
|
||||||
|
free_hash_buckets = rval;
|
||||||
|
rval++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rval = free_hash_buckets;
|
||||||
|
free_hash_buckets = rval -> next;
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +221,8 @@ void free_hash_bucket (ptr, file, line)
|
|||||||
const char *file;
|
const char *file;
|
||||||
int line;
|
int line;
|
||||||
{
|
{
|
||||||
dfree ((VOIDPTR)ptr, file, line);
|
ptr -> next = free_hash_buckets;
|
||||||
|
free_hash_buckets = ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct protocol *new_protocol (file, line)
|
struct protocol *new_protocol (file, line)
|
||||||
@@ -755,7 +771,7 @@ int dns_host_entry_dereference (ptr, file, line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
(*ptr) -> refcnt--;
|
(*ptr) -> refcnt--;
|
||||||
rc_register (file, line, ptr, bp, bp -> refcnt);
|
rc_register (file, line, ptr, *ptr, (*ptr) -> refcnt);
|
||||||
if (!(*ptr) -> refcnt)
|
if (!(*ptr) -> refcnt)
|
||||||
dfree ((*ptr), file, line);
|
dfree ((*ptr), file, line);
|
||||||
if ((*ptr) -> refcnt < 0) {
|
if ((*ptr) -> refcnt < 0) {
|
||||||
|
Reference in New Issue
Block a user