summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/freeaddrinfo.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libc/net/freeaddrinfo.c (renamed from src/lib/libc/stdlib/calloc.c)39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/lib/libc/stdlib/calloc.c b/src/lib/libc/net/freeaddrinfo.c
index 3353fab052..58702d0b18 100644
--- a/src/lib/libc/stdlib/calloc.c
+++ b/src/lib/libc/net/freeaddrinfo.c
@@ -1,6 +1,7 @@
1/*- 1/* $OpenBSD: freeaddrinfo.c,v 1.6 2005/03/25 13:24:11 otto Exp $ */
2 * Copyright (c) 1990 The Regents of the University of California. 2
3 * All rights reserved. 3/*
4 * Copyright (c) 1996, 1997, 1998, 1999, Craig Metz, All rights reserved.
4 * 5 *
5 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
@@ -12,9 +13,9 @@
12 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement: 15 * must display the following acknowledgement:
15 * This product includes software developed by the University of 16 * This product includes software developed by Craig Metz and
16 * California, Berkeley and its contributors. 17 * by other contributors.
17 * 4. Neither the name of the University nor the names of its contributors 18 * 4. Neither the name of the author nor the names of contributors
18 * may be used to endorse or promote products derived from this software 19 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission. 20 * without specific prior written permission.
20 * 21 *
@@ -31,23 +32,19 @@
31 * SUCH DAMAGE. 32 * SUCH DAMAGE.
32 */ 33 */
33 34
34#if defined(LIBC_SCCS) && !defined(lint)
35/*static char *sccsid = "from: @(#)calloc.c 5.6 (Berkeley) 2/23/91";*/
36static char *rcsid = "$Id: calloc.c,v 1.1.1.1 1995/10/18 08:42:17 deraadt Exp $";
37#endif /* LIBC_SCCS and not lint */
38
39#include <stdlib.h> 35#include <stdlib.h>
40#include <string.h> 36#include <netdb.h>
41 37
42void * 38void
43calloc(num, size) 39freeaddrinfo(struct addrinfo *ai)
44 size_t num;
45 register size_t size;
46{ 40{
47 register void *p; 41 struct addrinfo *p;
48 42
49 size *= num; 43 do {
50 if (p = malloc(size)) 44 p = ai;
51 memset(p, '\0', size); 45 ai = ai->ai_next;
52 return(p); 46 if (p->ai_canonname)
47 free(p->ai_canonname);
48 free((void *)p);
49 } while (ai);
53} 50}