summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcpd
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2010-01-01 19:10:25 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2010-01-01 19:10:25 +0000
commit5a53c7f9b8dfec850137311ce09961269df263c9 (patch)
tree7354c9cb624ae8e622c866090670b7fea737bd7c /usr.sbin/dhcpd
parentc62b7b6abcece5fda981529542a8a36c86480085 (diff)
A slightly more complex calloc() wrapper wrapper, new_hash_table(),
bites the dust.
Diffstat (limited to 'usr.sbin/dhcpd')
-rw-r--r--usr.sbin/dhcpd/alloc.c16
-rw-r--r--usr.sbin/dhcpd/dhcpd.h3
-rw-r--r--usr.sbin/dhcpd/hash.c13
3 files changed, 10 insertions, 22 deletions
diff --git a/usr.sbin/dhcpd/alloc.c b/usr.sbin/dhcpd/alloc.c
index cd060fb4cff..01db3635eb0 100644
--- a/usr.sbin/dhcpd/alloc.c
+++ b/usr.sbin/dhcpd/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.8 2010/01/01 18:01:44 krw Exp $ */
+/* $OpenBSD: alloc.c,v 1.9 2010/01/01 19:10:24 krw Exp $ */
/* Memory allocation... */
@@ -82,20 +82,6 @@ new_tree_cache(char *name)
return (rval);
}
-struct hash_table *
-new_hash_table(int count, char *name)
-{
- struct hash_table *rval;
-
- rval = dmalloc(sizeof(struct hash_table) -
- (DEFAULT_HASH_SIZE * sizeof(struct hash_bucket *)) +
- (count * sizeof(struct hash_bucket *)), name);
- if (rval == NULL)
- return (NULL);
- rval->hash_count = count;
- return (rval);
-}
-
void
free_hash_bucket(struct hash_bucket *ptr, char *name)
{
diff --git a/usr.sbin/dhcpd/dhcpd.h b/usr.sbin/dhcpd/dhcpd.h
index 949067b0b2c..2fb3205c541 100644
--- a/usr.sbin/dhcpd/dhcpd.h
+++ b/usr.sbin/dhcpd/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.41 2010/01/01 18:01:44 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.42 2010/01/01 19:10:24 krw Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -605,7 +605,6 @@ void write_leases(void);
void * dmalloc(int, char *);
void dfree(void *, char *);
struct tree_cache *new_tree_cache(char *);
-struct hash_table *new_hash_table(int, char *);
struct lease_state *new_lease_state(char *);
void free_lease_state(struct lease_state *, char *);
void free_lease(struct lease *, char *);
diff --git a/usr.sbin/dhcpd/hash.c b/usr.sbin/dhcpd/hash.c
index cfecb903b54..df4b8563847 100644
--- a/usr.sbin/dhcpd/hash.c
+++ b/usr.sbin/dhcpd/hash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hash.c,v 1.4 2010/01/01 06:25:37 krw Exp $ */
+/* $OpenBSD: hash.c,v 1.5 2010/01/01 19:10:24 krw Exp $ */
/* Routines for manipulating hash tables... */
@@ -47,11 +47,14 @@ static int do_hash(unsigned char *, int, int);
struct hash_table *
new_hash(void)
{
- struct hash_table *rv = new_hash_table(DEFAULT_HASH_SIZE, "new_hash");
+ struct hash_table *rv;
+
+ rv = calloc(1, sizeof(struct hash_table));
if (!rv)
- return (rv);
- memset(&rv->buckets[0], 0,
- DEFAULT_HASH_SIZE * sizeof(struct hash_bucket *));
+ warning("No memory for new hash.");
+ else
+ rv->hash_count = DEFAULT_HASH_SIZE;
+
return (rv);
}