Mercurial > octave
changeset 24736:cd25b9c5f808
eliminate useless public iterator typedefs in child_list class
* child-list.h, child-list.cc (child_list::iterator,
child_list::const_iterator): Delete typedefs.
(child_list::reap, child_list::wait): Use c++11 syntax for loop
iterating over all elements of list.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 11 Feb 2018 12:58:11 -0500 |
parents | 981990aaa931 |
children | 5be92b26ef8f |
files | liboctave/system/child-list.cc liboctave/system/child-list.h |
diffstat | 2 files changed, 3 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/system/child-list.cc Sun Feb 11 18:14:22 2018 +0100 +++ b/liboctave/system/child-list.cc Sun Feb 11 12:58:11 2018 -0500 @@ -56,15 +56,13 @@ { // Mark the record for PID invalid. - for (iterator p = m_list.begin (); p != m_list.end (); p++) + for (auto& oc : m_list) { // The call to the child::child_event_handler might // invalidate the iterator (for example, by calling // child_list::remove), so we increment the iterator // here. - child& oc = *p; - if (oc.have_status) { oc.have_status = 0; @@ -86,10 +84,8 @@ { bool retval = false; - for (iterator p = m_list.begin (); p != m_list.end (); p++) + for (auto& oc : m_list) { - child& oc = *p; - pid_t pid = oc.pid; if (pid > 0)
--- a/liboctave/system/child-list.h Sun Feb 11 18:14:22 2018 +0100 +++ b/liboctave/system/child-list.h Sun Feb 11 12:58:11 2018 -0500 @@ -69,15 +69,10 @@ int status; }; - class - OCTAVE_API - child_list + class OCTAVE_API child_list { public: - typedef base_list<child>::iterator iterator; - typedef base_list<child>::const_iterator const_iterator; - child_list (void) { } void insert (pid_t pid, child::child_event_handler f);