summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/external.cc
diff options
context:
space:
mode:
authorPeter Foley <pefoley2@pefoley.com>2016-04-02 11:36:18 -0400
committerCorinna Vinschen <corinna@vinschen.de>2016-04-04 16:46:51 +0200
commit0008bdea02b690ab19ffe997499cb9a96ee5a66d (patch)
treef5206f37aff7792be5369cdf865c33d5687b7c13 /winsup/cygwin/external.cc
parente7e6119241d02241c3d114cff037340c12245393 (diff)
downloadcygnal-0008bdea02b690ab19ffe997499cb9a96ee5a66d.tar.gz
cygnal-0008bdea02b690ab19ffe997499cb9a96ee5a66d.tar.bz2
cygnal-0008bdea02b690ab19ffe997499cb9a96ee5a66d.zip
Refactor to avoid nonnull checks on "this" pointer.
G++ 6.0 asserts that the "this" pointer is non-null for member functions. Refactor methods that check if "this" is non-null to resolve this. winsup/cygwin/ChangeLog: external.cc (cygwin_internal): Check for a null pinfo before calling cmdline. fhandler_dsp.cc (Audio::blockSize): Make static. fhandler_dsp.cc (Audio_in): add default_buf_info. fhandler_dsp.cc (Audio_out): Ditto. fhandler_dsp.cc (Audio_out::buf_info): Refactor method to call default_buf_info if dev_ is null. fhandler_dsp.cc (Audio_in::buf_info): Ditto. fhandler_dsp.cc (fhandler_dev_dsp::_ioctl): Call Audio_out::default_buf_info if audio_out_ is null. fhandler_dsp.cc (fhandler_dev_dsp::_ioctl): Call Audio_in::default_buf_info if audio_in_ is null. fhandler_process.cc (format_process_fd): Check if pinfo is null. fhandler_process.cc (format_process_root): Ditto. fhandler_process.cc (format_process_cwd): Ditto. fhandler_process.cc (format_process_cmdline): Ditto. signal.cc (tty_min::kill_pgrp): Ditto. signal.cc (_pinfo::kill0): Ditto. sigproc.cc (pid_exists): Ditto. sigproc.cc (remove_proc): Ditto. times.cc (clock_gettime): Ditto. times.cc (clock_getcpuclockid): Ditto. path.cc (cwdstuff::override_win32_cwd): Check if old_cwd is null. path.cc (fcwd_access_t::Free): Factor null check of "this" out to caller(s). pinfo.cc (_pinfo::exists): Ditto. pinfo.cc (_pinfo::fd): Ditto. pinfo.cc (_pinfo::fds): Ditto. pinfo.cc (_pinfo::root): Ditto. pinfo.cc (_pinfo::cwd): Ditto. pinfo.cc (_pinfo::cmdline): Ditto. signal.cc (_pinfo::kill): Ditto. pinfo.cc (_pinfo::commune_request): remove non-null check on "this", as this method is only called from pinfo.cc after null checks pinfo.cc (_pinfo::pipe_fhandler): remove non-null check on "this", as this method is only called from pipe.cc (fhandler_pipe::open) after a null check. Signed-off-by: Peter Foley <pefoley2@pefoley.com>
Diffstat (limited to 'winsup/cygwin/external.cc')
-rw-r--r--winsup/cygwin/external.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc
index 02335eb69..603a8d772 100644
--- a/winsup/cygwin/external.cc
+++ b/winsup/cygwin/external.cc
@@ -342,7 +342,7 @@ cygwin_internal (cygwin_getinfo_types t, ...)
size_t n;
pid_t pid = va_arg (arg, pid_t);
pinfo p (pid);
- res = (uintptr_t) p->cmdline (n);
+ res = p ? (uintptr_t) p->cmdline (n) : 0;
}
break;
case CW_CHECK_NTSEC: