diff options
| author | christos <christos@NetBSD.org> | 2017-01-12 01:02:09 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2017-01-12 01:02:09 +0000 |
| commit | 660407963c67925c8ae088115bc1485d695b934b (patch) | |
| tree | ead01ee75c66d89eb1905edfbc0162f5a98ef2f4 /lib/libc/stdlib/malloc.c | |
| parent | c7416993267ef232800397d79a00b64152f944de (diff) | |
make this smaller.
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
| -rw-r--r-- | lib/libc/stdlib/malloc.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 68fed36cfcc..4c51b42fb85 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: malloc.c,v 1.56 2014/09/18 13:58:20 christos Exp $ */ +/* $NetBSD: malloc.c,v 1.57 2017/01/12 01:02:09 christos Exp $ */ /* * ---------------------------------------------------------------------------- @@ -84,21 +84,27 @@ void utrace(struct ut *, int); #include <sys/types.h> #if defined(__NetBSD__) -# define malloc_minsize 16U -# define HAS_UTRACE -# define UTRACE_LABEL "malloc", -#include <sys/cdefs.h> -#include "extern.h" -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: malloc.c,v 1.56 2014/09/18 13:58:20 christos Exp $"); -#endif /* LIBC_SCCS and not lint */ +# define malloc_minsize 16U +# ifdef _LIBC +# define HAS_UTRACE +# define UTRACE_LABEL "malloc", int utrace(const char *, void *, size_t); - -#include <reentrant.h> +# endif +# include <sys/cdefs.h> +# include "extern.h" +# if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: malloc.c,v 1.57 2017/01/12 01:02:09 christos Exp $"); +# endif /* LIBC_SCCS and not lint */ +# include <reentrant.h> +# ifdef _REENTRANT extern int __isthreaded; static mutex_t thread_lock = MUTEX_INITIALIZER; -#define _MALLOC_LOCK() if (__isthreaded) mutex_lock(&thread_lock); -#define _MALLOC_UNLOCK() if (__isthreaded) mutex_unlock(&thread_lock); +# define _MALLOC_LOCK() if (__isthreaded) mutex_lock(&thread_lock); +# define _MALLOC_UNLOCK() if (__isthreaded) mutex_unlock(&thread_lock); +# else +# define _MALLOC_LOCK() +# define _MALLOC_UNLOCK() +# endif #endif /* __NetBSD__ */ #if defined(__sparc__) && defined(sun) @@ -472,8 +478,10 @@ malloc_init(void) continue; b[j] = '\0'; p = b; +#ifdef _LIBC } else if (i == 1 && issetugid() == 0) { p = getenv("MALLOC_OPTIONS"); +#endif } else if (i == 1) { continue; } else { |
