/* $OpenBSD: alloc.c,v 1.9 2004/05/04 20:28:40 deraadt Exp $ */12/* Memory allocation... */34/*-5* SPDX-License-Identifier: BSD-3-Clause6*7* Copyright (c) 1995, 1996, 1998 The Internet Software Consortium.8* All rights reserved.9*10* Redistribution and use in source and binary forms, with or without11* modification, are permitted provided that the following conditions12* are met:13*14* 1. Redistributions of source code must retain the above copyright15* notice, this list of conditions and the following disclaimer.16* 2. Redistributions in binary form must reproduce the above copyright17* notice, this list of conditions and the following disclaimer in the18* documentation and/or other materials provided with the distribution.19* 3. Neither the name of The Internet Software Consortium nor the names20* of its contributors may be used to endorse or promote products derived21* from this software without specific prior written permission.22*23* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND24* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,25* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF26* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE27* DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR28* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,29* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT30* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF31* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND32* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,33* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT34* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF35* SUCH DAMAGE.36*37* This software has been written for the Internet Software Consortium38* by Ted Lemon <[email protected]> in cooperation with Vixie39* Enterprises. To learn more about the Internet Software Consortium,40* see ``http://www.vix.com/isc''. To learn more about Vixie41* Enterprises, see ``http://www.vix.com''.42*/4344#include <sys/cdefs.h>45#include "dhcpd.h"4647struct string_list *48new_string_list(size_t size)49{50struct string_list *rval;5152rval = calloc(1, sizeof(struct string_list) + size);53if (rval != NULL)54rval->string = ((char *)rval) + sizeof(struct string_list);55return (rval);56}5758struct hash_table *59new_hash_table(int count)60{61struct hash_table *rval;6263rval = calloc(1, sizeof(struct hash_table) -64(DEFAULT_HASH_SIZE * sizeof(struct hash_bucket *)) +65(count * sizeof(struct hash_bucket *)));66if (rval == NULL)67return (NULL);68rval->hash_count = count;69return (rval);70}7172struct hash_bucket *73new_hash_bucket(void)74{75struct hash_bucket *rval = calloc(1, sizeof(struct hash_bucket));7677return (rval);78}798081