Module Name:    src
Committed By:   christos
Date:           Thu Jan 12 01:02:09 UTC 2017

Modified Files:
        src/lib/libc/stdlib: malloc.c

Log Message:
make this smaller.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/lib/libc/stdlib/malloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdlib/malloc.c
diff -u src/lib/libc/stdlib/malloc.c:1.56 src/lib/libc/stdlib/malloc.c:1.57
--- src/lib/libc/stdlib/malloc.c:1.56	Thu Sep 18 09:58:20 2014
+++ src/lib/libc/stdlib/malloc.c	Wed Jan 11 20:02:09 2017
@@ -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 {

Reply via email to