diff options
author | 2015-12-11 04:26:01 +0000 | |
---|---|---|
committer | 2015-12-11 04:26:01 +0000 | |
commit | 8b668fe1dba3a1db12e09e1c086f4072a0cf55b0 (patch) | |
tree | ab3637ffafa2e076f3fd587c7f35294e518404d9 | |
parent | Remove NULL-checks before sshbuf_free(). (diff) | |
download | wireguard-openbsd-8b668fe1dba3a1db12e09e1c086f4072a0cf55b0.tar.xz wireguard-openbsd-8b668fe1dba3a1db12e09e1c086f4072a0cf55b0.zip |
Remove debugging fluff from allocation functions. There's probably more
of this stuff elsewhere in amd.
"such clutter just makes people not care" deraadt@
-rw-r--r-- | usr.sbin/amd/amd/xutil.c | 22 | ||||
-rw-r--r-- | usr.sbin/amd/amq/amq.c | 10 | ||||
-rw-r--r-- | usr.sbin/amd/include/config.h | 6 |
3 files changed, 5 insertions, 33 deletions
diff --git a/usr.sbin/amd/amd/xutil.c b/usr.sbin/amd/amd/xutil.c index 7e02b0116c4..ebfb6d05e43 100644 --- a/usr.sbin/amd/amd/xutil.c +++ b/usr.sbin/amd/amd/xutil.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)xutil.c 8.1 (Berkeley) 6/6/93 - * $Id: xutil.c,v 1.17 2014/10/26 02:58:43 guenther Exp $ + * $Id: xutil.c,v 1.18 2015/12/11 04:26:01 mmcc Exp $ */ #include "am.h" @@ -84,13 +84,9 @@ xmalloc(size_t len) int retries = 600; do { - p = malloc(len); - if (p) { -#if defined(DEBUG) && defined(DEBUG_MEM) - Debug(D_MEM) plog(XLOG_DEBUG, "Allocated size %zu; block %#x", len, p); -#endif /* defined(DEBUG) && defined(DEBUG_MEM) */ + if ((p = malloc(len)) != NULL) return p; - } + if (retries > 0) { plog(XLOG_ERROR, "Retrying memory allocation"); sleep(1); @@ -103,10 +99,6 @@ xmalloc(size_t len) void * xreallocarray(void *ptr, size_t nmemb, size_t size) { -#if defined(DEBUG) && defined(DEBUG_MEM) - Debug(D_MEM) plog(XLOG_DEBUG, "Reallocated nmemb %zu of size %zu; block %#x", nmemb, size, ptr); -#endif /* defined(DEBUG) && defined(DEBUG_MEM) */ - ptr = reallocarray(ptr, nmemb, size); if (ptr == NULL) @@ -114,14 +106,6 @@ xreallocarray(void *ptr, size_t nmemb, size_t size) return (ptr); } -#if defined(DEBUG) && defined(DEBUG_MEM) -xfree(char *f, int l, void *p) -{ - Debug(D_MEM) plog(XLOG_DEBUG, "Free in %s:%d: block %#x", f, l, p); -#undef free - free(p); -} -#endif /* defined(DEBUG) && defined(DEBUG_MEM) */ #ifdef DEBUG_MEM static int mem_bytes; static int orig_mem_bytes; diff --git a/usr.sbin/amd/amq/amq.c b/usr.sbin/amd/amq/amq.c index 640c617a523..e0b36894621 100644 --- a/usr.sbin/amd/amq/amq.c +++ b/usr.sbin/amd/amq/amq.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)amq.c 8.1 (Berkeley) 6/7/93 - * $Id: amq.c,v 1.18 2015/01/21 09:50:25 guenther Exp $ + * $Id: amq.c,v 1.19 2015/12/11 04:26:01 mmcc Exp $ */ /* @@ -565,11 +565,3 @@ privsock(int ty) } return sock; } - -#ifdef DEBUG -void -xfree(char *f, char *l, void *p) -{ - free(p); -} -#endif /* DEBUG */ diff --git a/usr.sbin/amd/include/config.h b/usr.sbin/amd/include/config.h index c0c9e89df4c..eacdb8cf468 100644 --- a/usr.sbin/amd/include/config.h +++ b/usr.sbin/amd/include/config.h @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)config.h 8.1 (Berkeley) 6/6/93 - * $Id: config.h,v 1.11 2014/10/26 02:32:51 guenther Exp $ + * $Id: config.h,v 1.12 2015/12/11 04:26:01 mmcc Exp $ */ /* @@ -72,10 +72,6 @@ extern int orig_umask; /* umask() on startup */ #ifdef DEBUG #define D_ALL (~0) -#ifdef DEBUG_MEM -#define free(x) xfree(__FILE__,__LINE__,x) -#endif /* DEBUG_MEM */ - #define Debug(x) if (!(debug_flags & (x))) ; else #define dlog Debug(D_FULL) dplog #endif /* DEBUG */ |