Browse Source

Move cfree(3) weak symbol into a seperate file

OPENBSD_2_0
tholo 28 years ago
parent
commit
7930b7d1e8
3 changed files with 52 additions and 24 deletions
  1. +2
    -2
      src/lib/libc/stdlib/Makefile.inc
  2. +49
    -0
      src/lib/libc/stdlib/cfree.c
  3. +1
    -22
      src/lib/libc/stdlib/malloc.c

+ 2
- 2
src/lib/libc/stdlib/Makefile.inc View File

@ -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 # stdlib sources
.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/stdlib ${.CURDIR}/stdlib .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 \ 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 \ 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 \ 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 \ _rand48.c drand48.c erand48.c jrand48.c lcong48.c lrand48.c \


+ 49
- 0
src/lib/libc/stdlib/cfree.c View File

@ -0,0 +1,49 @@
/* $OpenBSD: cfree.c,v 1.1 1996/08/21 03:47:22 tholo Exp $ */
/*
* Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
* 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 <sys/cdefs.h>
#ifdef __indr_reference
__indr_reference(free, cfree);
#else
void
cfree(p)
void *p;
{
free(p);
}
#endif

+ 1
- 22
src/lib/libc/stdlib/malloc.c View File

@ -8,7 +8,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #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 */ #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 #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) #if defined(EXTRA_SANITY) && !defined(MALLOC_STATS)
# define MALLOC_STATS /* required for EXTRA_SANITY */ # define MALLOC_STATS /* required for EXTRA_SANITY */
#endif #endif
@ -1258,19 +1253,3 @@ free(ptr)
#endif #endif
return; 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 */

Loading…
Cancel
Save