Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdlib make this smaller.
details: https://anonhg.NetBSD.org/src/rev/894aaff80dae
branches: trunk
changeset: 350455:894aaff80dae
user: christos <christos%NetBSD.org@localhost>
date: Thu Jan 12 01:02:09 2017 +0000
description:
make this smaller.
diffstat:
lib/libc/stdlib/malloc.c | 34 +++++++++++++++++++++-------------
1 files changed, 21 insertions(+), 13 deletions(-)
diffs (60 lines):
diff -r b9b2ba9ced04 -r 894aaff80dae lib/libc/stdlib/malloc.c
--- a/lib/libc/stdlib/malloc.c Thu Jan 12 00:43:55 2017 +0000
+++ b/lib/libc/stdlib/malloc.c Thu Jan 12 01:02:09 2017 +0000
@@ -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 @@
#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 @@
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 {
Home |
Main Index |
Thread Index |
Old Index