From 8e732f7f7f684f22b283f39a5d407375b3b0b3af Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 1 Apr 2016 14:04:09 +0200 Subject: [PATCH] Remove MALLOC_CHECK and calls to it entirely MALLOC_CHECK got useless with commit b259af5. Remove it throughout. Signed-off-by: Corinna Vinschen --- winsup/cygwin/cygheap.cc | 13 ------------- winsup/cygwin/dcrt0.cc | 1 - winsup/cygwin/debug.h | 2 -- winsup/cygwin/dtable.cc | 2 -- winsup/cygwin/environ.cc | 6 ------ winsup/cygwin/exec.cc | 8 -------- winsup/cygwin/fork.cc | 7 ------- winsup/cygwin/mount.cc | 6 ------ winsup/cygwin/path.cc | 8 -------- winsup/cygwin/strfuncs.cc | 1 - winsup/cygwin/syscalls.cc | 8 -------- 11 files changed, 62 deletions(-) diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 7a18d18a6..615dfc1b0 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -409,7 +409,6 @@ creturn (cygheap_types x, cygheap_entry * c, unsigned len, const char *fn = NULL char *cend = ((char *) c + sizeof (*c) + len); if (cygheap_max < cend) cygheap_max = cend; - MALLOC_CHECK; return (void *) c->data; } @@ -417,7 +416,6 @@ inline static void * cmalloc (cygheap_types x, size_t n, const char *fn) { cygheap_entry *c; - MALLOC_CHECK; c = (cygheap_entry *) _cmalloc (sizeof_cygheap (n)); return creturn (x, c, n, fn); } @@ -437,7 +435,6 @@ cmalloc_abort (cygheap_types x, size_t n) inline static void * crealloc (void *s, size_t n, const char *fn) { - MALLOC_CHECK; if (s == NULL) return cmalloc (HEAP_STR, n); // kludge @@ -465,7 +462,6 @@ cfree (void *s) { assert (!inheap (s)); _cfree (tocygheap (s)); - MALLOC_CHECK; } extern "C" void __reg2 @@ -480,7 +476,6 @@ inline static void * ccalloc (cygheap_types x, size_t n, size_t size, const char *fn) { cygheap_entry *c; - MALLOC_CHECK; n *= size; c = (cygheap_entry *) _cmalloc (sizeof_cygheap (n)); if (c) @@ -503,48 +498,40 @@ ccalloc_abort (cygheap_types x, size_t n, size_t size) extern "C" PWCHAR __reg1 cwcsdup (PCWSTR s) { - MALLOC_CHECK; PWCHAR p = (PWCHAR) cmalloc (HEAP_STR, (wcslen (s) + 1) * sizeof (WCHAR)); if (!p) return NULL; wcpcpy (p, s); - MALLOC_CHECK; return p; } extern "C" PWCHAR __reg1 cwcsdup1 (PCWSTR s) { - MALLOC_CHECK; PWCHAR p = (PWCHAR) cmalloc (HEAP_1_STR, (wcslen (s) + 1) * sizeof (WCHAR)); if (!p) return NULL; wcpcpy (p, s); - MALLOC_CHECK; return p; } extern "C" char *__reg1 cstrdup (const char *s) { - MALLOC_CHECK; char *p = (char *) cmalloc (HEAP_STR, strlen (s) + 1); if (!p) return NULL; strcpy (p, s); - MALLOC_CHECK; return p; } extern "C" char *__reg1 cstrdup1 (const char *s) { - MALLOC_CHECK; char *p = (char *) cmalloc (HEAP_1_STR, strlen (s) + 1); if (!p) return NULL; strcpy (p, s); - MALLOC_CHECK; return p; } diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index aaa8c444e..cbe7f2591 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -1011,7 +1011,6 @@ dll_crt0_1 (void *) /* Disable case-insensitive globbing */ ignore_case_with_glob = false; - MALLOC_CHECK; cygbench (__progname); ld_preload (); diff --git a/winsup/cygwin/debug.h b/winsup/cygwin/debug.h index 602ab9326..a6182b145 100644 --- a/winsup/cygwin/debug.h +++ b/winsup/cygwin/debug.h @@ -7,8 +7,6 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ -#define MALLOC_CHECK do {} while (0) - #if !defined(_DEBUG_H_) #define _DEBUG_H_ diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 08b746e6e..7f12ff5f7 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -720,7 +720,6 @@ dtable::dup3 (int oldfd, int newfd, int flags) int res = -1; fhandler_base *newfh = NULL; // = NULL to avoid an incorrect warning - MALLOC_CHECK; debug_printf ("dup3 (%d, %d, %y)", oldfd, newfd, flags); lock (); bool do_unlock = true; @@ -786,7 +785,6 @@ dtable::dup3 (int oldfd, int newfd, int flags) do_unlock = unlock_on_return; done: - MALLOC_CHECK; if (do_unlock) unlock (); syscall_printf ("%R = dup3(%d, %d, %y)", res, oldfd, newfd, flags); diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 227f55966..b1553118d 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -393,7 +393,6 @@ win_env::~win_env () void win_env::add_cache (const char *in_posix, const char *in_native) { - MALLOC_CHECK; posix = (char *) realloc (posix, strlen (in_posix) + 1); strcpy (posix, in_posix); if (in_native) @@ -409,7 +408,6 @@ win_env::add_cache (const char *in_posix, const char *in_native) native = (char *) realloc (native, namelen + 1 + strlen (buf)); stpcpy (stpcpy (native, name), buf); } - MALLOC_CHECK; if (immediate && cygwin_finished_initializing) { wchar_t s[sys_mbstowcs (NULL, 0, native) + 1]; @@ -489,7 +487,6 @@ posify_maybe (char **here, const char *value, char *outenv) debug_printf ("env var converted to %s", outenv); *here = strdup (outenv); free (src); - MALLOC_CHECK; } /* Returns pointer to value associated with name, if any, else NULL. @@ -519,7 +516,6 @@ my_findenv (const char *name, int *offset) *offset = p - cur_environ (); return (char *) (++c); } - MALLOC_CHECK; return NULL; } @@ -657,7 +653,6 @@ _addenv (const char *name, const char *value, int overwrite) if (strcmp (name, "CYGWIN") == 0) parse_options (value); - MALLOC_CHECK; return 0; } @@ -865,7 +860,6 @@ environ_init (char **envp, int envc) if (p) parse_options (p); } - MALLOC_CHECK; } __except (NO_ERROR) { diff --git a/winsup/cygwin/exec.cc b/winsup/cygwin/exec.cc index a9c4bf388..fd782ac19 100644 --- a/winsup/cygwin/exec.cc +++ b/winsup/cygwin/exec.cc @@ -35,7 +35,6 @@ execl (const char *path, const char *arg0, ...) argv[i] = va_arg (args, const char *); while (argv[i++] != NULL); va_end (args); - MALLOC_CHECK; return spawnve (_P_OVERLAY, path, (char * const *) argv, cur_environ ()); } @@ -55,7 +54,6 @@ execle (const char *path, const char *arg0, ...) while (argv[i++] != NULL); envp = va_arg (args, const char * const *); va_end (args); - MALLOC_CHECK; return spawnve (_P_OVERLAY, path, (char * const *) argv, envp); } @@ -74,7 +72,6 @@ execlp (const char *file, const char *arg0, ...) argv[i] = va_arg (args, const char *); while (argv[i++] != NULL); va_end (args); - MALLOC_CHECK; return spawnve (_P_OVERLAY | _P_PATH_TYPE_EXEC, find_exec (file, buf, "PATH", FE_NNF) ?: "", (char * const *) argv, cur_environ ()); @@ -83,14 +80,12 @@ execlp (const char *file, const char *arg0, ...) extern "C" int execv (const char *path, char * const *argv) { - MALLOC_CHECK; return spawnve (_P_OVERLAY, path, argv, cur_environ ()); } extern "C" int execve (const char *path, char *const argv[], char *const envp[]) { - MALLOC_CHECK; return spawnve (_P_OVERLAY, path, argv, envp); } EXPORT_ALIAS (execve, _execve) /* For newlib */ @@ -100,7 +95,6 @@ execvp (const char *file, char * const *argv) { path_conv buf; - MALLOC_CHECK; return spawnve (_P_OVERLAY | _P_PATH_TYPE_EXEC, find_exec (file, buf, "PATH", FE_NNF) ?: "", argv, cur_environ ()); @@ -111,7 +105,6 @@ execvpe (const char *file, char * const *argv, char *const *envp) { path_conv buf; - MALLOC_CHECK; return spawnve (_P_OVERLAY | _P_PATH_TYPE_EXEC, find_exec (file, buf, "PATH", FE_NNF) ?: "", argv, envp); @@ -127,7 +120,6 @@ fexecve (int fd, char * const *argv, char *const *envp) return -1; } - MALLOC_CHECK; return spawnve (_P_OVERLAY, cfd->pc.get_win32 (), argv, envp); } diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index e7b9ea441..ce54e39e3 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -174,8 +174,6 @@ frok::child (volatile char * volatile here) } #endif - MALLOC_CHECK; - /* Incredible but true: If we use sockets and SYSV IPC shared memory, there's a good chance that a duplicated socket in the child occupies memory which is needed to duplicate shared memory from the parent @@ -186,8 +184,6 @@ frok::child (volatile char * volatile here) if (fixup_shms_after_fork ()) api_fatal ("recreate_shm areas after fork failed"); - MALLOC_CHECK; - /* If we haven't dynamically loaded any dlls, just signal the parent. Otherwise, load all the dlls, tell the parent that we're done, and wait for the parent to fill in the. @@ -463,7 +459,6 @@ frok::parent (volatile char * volatile stack_here) Note: variables marked as NO_COPY will not be copied since they are placed in a protected segment. */ - MALLOC_CHECK; const void *impure_beg; const void *impure_end; const char *impure; @@ -482,7 +477,6 @@ frok::parent (volatile char * volatile stack_here) __malloc_unlock (); locked = false; - MALLOC_CHECK; if (!rc) { this_errno = get_errno (); @@ -622,7 +616,6 @@ fork () } } - MALLOC_CHECK; if (ischild) { myself->process_state |= PID_ACTIVE; diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index 22bc49c4a..fcb31aad2 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -597,8 +597,6 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, device& dev, { bool chroot_ok = !cygheap->root.exists (); - MALLOC_CHECK; - dev = FH_FS; *flags = 0; @@ -630,7 +628,6 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, device& dev, goto out_no_chroot_check; } - MALLOC_CHECK; /* If the path is on a network drive or a //./ resp. //?/ path prefix, bypass the mount table. If it's // or //MACHINE, use the netdrive device. */ @@ -740,7 +737,6 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, device& dev, backslashify (src_path, dst + offset, 0); } out: - MALLOC_CHECK; if (chroot_ok || cygheap->root.ischroot_native (dst)) rc = 0; else @@ -905,7 +901,6 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path, debug_printf ("conv_to_posix_path (%s, 0x%x, %s)", src_path, ccp_flags, append_slash ? "add-slash" : "no-add-slash"); - MALLOC_CHECK; if (src_path_len >= NT_MAX_PATH) { @@ -1008,7 +1003,6 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path, out: debug_printf ("%s = conv_to_posix_path (%s)", posix_path, src_path); - MALLOC_CHECK; return 0; } diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 20391bf98..a839c0ad7 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -711,7 +711,6 @@ path_conv::check (const char *src, unsigned opt, /* This loop handles symlink expansion. */ for (;;) { - MALLOC_CHECK; assert (src); is_relpath = !isabspath (src); @@ -1067,9 +1066,6 @@ path_conv::check (const char *src, unsigned opt, return; } - MALLOC_CHECK; - - /* Place the link content, possibly with head and/or tail, in tmp_buf */ @@ -3276,7 +3272,6 @@ chdir (const char *in_dir) res = -1; } __endtry - MALLOC_CHECK; return res; } @@ -4686,8 +4681,6 @@ cwdstuff::reset_posix (wchar_t *w_cwd) char * cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen) { - MALLOC_CHECK; - tmp_pathbuf tp; if (ulen) /* nothing */; @@ -4731,7 +4724,6 @@ cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen) out: syscall_printf ("(%s) = cwdstuff::get (%p, %u, %d, %d), errno %d", buf, buf, ulen, need_posix, with_chroot, errno); - MALLOC_CHECK; return buf; } diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc index ad6773823..1cbf91a5e 100644 --- a/winsup/cygwin/strfuncs.cc +++ b/winsup/cygwin/strfuncs.cc @@ -708,7 +708,6 @@ strccpy (char *__restrict s1, const char **__restrict s2, char c) *s1++ = *((*s2)++); *s1 = 0; - MALLOC_CHECK; return s1; } diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 5d881f5d7..4b494419a 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1196,7 +1196,6 @@ read (int fd, void *ptr, size_t len) __except (EFAULT) {} __endtry syscall_printf ("%lR = read(%d, %p, %d)", res, fd, ptr, len); - MALLOC_CHECK; return (ssize_t) res; } @@ -1238,7 +1237,6 @@ readv (int fd, const struct iovec *const iov, const int iovcnt) __except (EFAULT) {} __endtry syscall_printf ("%lR = readv(%d, %p, %d)", res, fd, iov, iovcnt); - MALLOC_CHECK; return res; } @@ -1289,7 +1287,6 @@ write (int fd, const void *ptr, size_t len) __except (EFAULT) {} __endtry syscall_printf ("%lR = write(%d, %p, %d)", res, fd, ptr, len); - MALLOC_CHECK; return res; } @@ -1336,7 +1333,6 @@ writev (const int fd, const struct iovec *const iov, const int iovcnt) paranoid_printf ("%lR = writev(%d, %p, %d)", res, fd, iov, iovcnt); else syscall_printf ("%lR = writev(%d, %p, %d)", res, fd, iov, iovcnt); - MALLOC_CHECK; return res; } @@ -1491,7 +1487,6 @@ close (int fd) pthread_testcancel (); - MALLOC_CHECK; cygheap_fdget cfd (fd, true); if (cfd < 0) res = -1; @@ -1503,7 +1498,6 @@ close (int fd) } syscall_printf ("%R = close(%d)", res, fd); - MALLOC_CHECK; return res; } @@ -1936,7 +1930,6 @@ stat_worker (path_conv &pc, struct stat *buf) } __except (EFAULT) {} __endtry - MALLOC_CHECK; syscall_printf ("%d = (%S,%p)", res, pc.get_nt_native_path (), buf); return res; } @@ -3048,7 +3041,6 @@ statvfs (const char *name, struct statvfs *sfs) __except (EFAULT) {} __endtry delete fh; - MALLOC_CHECK; if (get_errno () != EFAULT) syscall_printf ("%R = statvfs(%s,%p)", res, name, sfs); return res;