]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
add allocator for lease state structure and protocol structure
authorTed Lemon <source@isc.org>
Thu, 6 Mar 1997 06:49:29 +0000 (06:49 +0000)
committerTed Lemon <source@isc.org>
Thu, 6 Mar 1997 06:49:29 +0000 (06:49 +0000)
common/alloc.c

index 7799fc377721e9813aecf7edf267686153079571..0634bb4d5bd9ddaf98ffcbc00aecfa786c03d522 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: alloc.c,v 1.10 1997/03/05 06:34:27 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: alloc.c,v 1.11 1997/03/06 06:49:29 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -181,6 +181,45 @@ struct group *new_group (name)
        return rval;
 }
 
+struct protocol *new_protocol (name)
+       char *name;
+{
+       struct protocol *rval = dmalloc (sizeof (struct group), name);
+       return rval;
+}
+
+struct lease_state *free_lease_states;
+
+struct lease_state *new_lease_state (name)
+       char *name;
+{
+       struct lease_state *rval;
+
+       if (free_lease_states) {
+               rval = free_lease_states;
+               free_lease_states =
+                       (struct lease_state *)(free_lease_states -> next);
+       } else {
+               rval = dmalloc (256 * sizeof (struct tree_cache *), name);
+       }
+       return rval;
+}
+
+void free_lease_state (ptr, name)
+       struct lease_state *ptr;
+       char *name;
+{
+       ptr -> next = free_lease_states;
+       free_lease_states = ptr;
+}
+
+void free_protocol (ptr, name)
+       struct protocol *ptr;
+       char *name;
+{
+       dfree ((VOIDPTR)ptr, name);
+}
+
 void free_group (ptr, name)
        struct group *ptr;
        char *name;