From 7930b7d1e81734d9c8dff149d331281edcd1f580 Mon Sep 17 00:00:00 2001 From: tholo <> Date: Wed, 21 Aug 1996 03:47:22 +0000 Subject: [PATCH] Move cfree(3) weak symbol into a seperate file --- src/lib/libc/stdlib/Makefile.inc | 4 +-- src/lib/libc/stdlib/cfree.c | 49 ++++++++++++++++++++++++++++++++ src/lib/libc/stdlib/malloc.c | 23 +-------------- 3 files changed, 52 insertions(+), 24 deletions(-) create mode 100644 src/lib/libc/stdlib/cfree.c diff --git a/src/lib/libc/stdlib/Makefile.inc b/src/lib/libc/stdlib/Makefile.inc index bc8fb87d..f224baed 100644 --- a/src/lib/libc/stdlib/Makefile.inc +++ b/src/lib/libc/stdlib/Makefile.inc @@ -1,10 +1,10 @@ -# $OpenBSD: Makefile.inc,v 1.5 1996/08/21 03:17:55 downsj Exp $ +# $OpenBSD: Makefile.inc,v 1.6 1996/08/21 03:47:21 tholo Exp $ # stdlib sources .PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/stdlib ${.CURDIR}/stdlib SRCS+= a64l.c abort.c atexit.c atoi.c atof.c atol.c bsearch.c calloc.c \ - exit.c getenv.c getopt.c heapsort.c l64a.c malloc.c merge.c \ + cfree.c exit.c getenv.c getopt.c heapsort.c l64a.c malloc.c merge.c \ multibyte.c putenv.c qsort.c radixsort.c rand.c random.c realpath.c \ setenv.c strtod.c strtol.c strtoq.c strtoul.c strtouq.c system.c \ _rand48.c drand48.c erand48.c jrand48.c lcong48.c lrand48.c \ diff --git a/src/lib/libc/stdlib/cfree.c b/src/lib/libc/stdlib/cfree.c new file mode 100644 index 00000000..3af32039 --- /dev/null +++ b/src/lib/libc/stdlib/cfree.c @@ -0,0 +1,49 @@ +/* $OpenBSD: cfree.c,v 1.1 1996/08/21 03:47:22 tholo Exp $ */ + +/* + * Copyright (c) 1996 SigmaSoft, Th. Lockert + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by SigmaSoft, Th. Lockert. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char rcsid[] = "$OpenBSD: cfree.c,v 1.1 1996/08/21 03:47:22 tholo Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include + +#ifdef __indr_reference +__indr_reference(free, cfree); +#else + +void +cfree(p) + void *p; +{ + free(p); +} +#endif diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index a210c3f3..b9964b9b 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c @@ -8,7 +8,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: malloc.c,v 1.7 1996/08/20 17:56:52 tholo Exp $"; +static char rcsid[] = "$OpenBSD: malloc.c,v 1.8 1996/08/21 03:47:22 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -24,11 +24,6 @@ static char rcsid[] = "$OpenBSD: malloc.c,v 1.7 1996/08/20 17:56:52 tholo Exp $" */ #define MALLOC_STATS -/* - * Defining CFREE_STUB will include a cfree() stub that just calls free(). - */ -#define CFREE_STUB - #if defined(EXTRA_SANITY) && !defined(MALLOC_STATS) # define MALLOC_STATS /* required for EXTRA_SANITY */ #endif @@ -1258,19 +1253,3 @@ free(ptr) #endif return; } - -#ifdef CFREE_STUB - -#ifdef __indr_reference -__indr_reference(free, cfree); -#else /* __indr_reference */ - -void -cfree(p) - void *p; -{ - free(p); -} -#endif /* not __indr_reference */ - -#endif /* CFREE_STUB */