From 4e001adf8da1a35d0da86bc5d92bfb87f6f7bc33 Mon Sep 17 00:00:00 2001 From: wfjm Date: Sun, 4 Nov 2018 09:01:47 +0100 Subject: [PATCH] replace boost/foreach --- tools/src/librlink/RlinkCommandList.cpp | 17 +++++++---------- tools/src/librw11/Rw11CntlPC11.cpp | 7 +++---- tools/src/librw11/Rw11CntlRHRP.cpp | 9 ++++----- tools/src/librw11/Rw11CntlRK11.cpp | 9 ++++----- tools/src/librw11/Rw11CntlRL11.cpp | 9 ++++----- tools/src/librw11/Rw11CntlTM11.cpp | 7 +++---- 6 files changed, 25 insertions(+), 33 deletions(-) diff --git a/tools/src/librlink/RlinkCommandList.cpp b/tools/src/librlink/RlinkCommandList.cpp index 0d5492f4..44d6a2c8 100644 --- a/tools/src/librlink/RlinkCommandList.cpp +++ b/tools/src/librlink/RlinkCommandList.cpp @@ -1,4 +1,4 @@ -// $Id: RlinkCommandList.cpp 1047 2018-09-16 11:08:41Z mueller $ +// $Id: RlinkCommandList.cpp 1062 2018-10-28 11:14:20Z mueller $ // // Copyright 2011-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-10-28 1062 1.3.3 replace boost/foreach // 2018-09-16 1047 1.3.2 coverity fixup (uninitialized scalar) // 2017-04-02 865 1.3.1 Dump(): add detail arg // 2015-04-02 661 1.3 expect logic: add SetLastExpect methods @@ -31,8 +32,6 @@ */ #include -#include "boost/foreach.hpp" -#define foreach_ BOOST_FOREACH #include "RlinkCommandList.hpp" @@ -75,7 +74,7 @@ RlinkCommandList::RlinkCommandList(const RlinkCommandList& rhs) RlinkCommandList::~RlinkCommandList() { - foreach_ (RlinkCommand* pcmd, fList) { delete pcmd; } + for (auto& pcmd: fList) delete pcmd; } //------------------------------------------+----------------------------------- @@ -285,7 +284,7 @@ void RlinkCommandList::SetLastExpect(RlinkCommandExpect* pexp) void RlinkCommandList::Clear() { - foreach_ (RlinkCommand* pcmd, fList) { delete pcmd; } + for (auto& pcmd: fList) delete pcmd; fList.clear(); fLaboIndex = -1; return; @@ -298,9 +297,7 @@ void RlinkCommandList::Print(std::ostream& os, const RlinkAddrMap* pamap, size_t abase, size_t dbase, size_t sbase) const { - foreach_ (RlinkCommand* pcmd, fList) { - pcmd->Print(os, pamap, abase, dbase, sbase); - } + for (auto& pcmd: fList) pcmd->Print(os, pamap, abase, dbase, sbase); return; } @@ -335,8 +332,8 @@ RlinkCommandList& Retro::RlinkCommandList::operator=( const RlinkCommandList& rhs) { if (&rhs == this) return *this; - - foreach_ (RlinkCommand* pcmd, fList) { delete pcmd; } + + for (auto& pcmd: fList) delete pcmd; fList.clear(); for (size_t i=0; i // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-10-28 1062 1.3.1 replace boost/foreach // 2017-05-14 897 1.3 trace received chars // 2017-04-02 865 1.2.2 Dump(): add detail arg // 2017-03-03 858 1.2.1 use cntl name as message prefix @@ -27,8 +28,6 @@ */ #include "boost/bind.hpp" -#include "boost/foreach.hpp" -#define foreach_ BOOST_FOREACH #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" @@ -215,7 +214,7 @@ bool Rw11CntlPC11::BootCode(size_t /*unit*/, std::vector& code, }; code.clear(); - foreach_ (uint16_t& w, bootcode) code.push_back(w); + code.insert(code.end(), std::begin(bootcode), std::end(bootcode)); aload = kBOOT_START; astart = kBOOT_START+2; return true; diff --git a/tools/src/librw11/Rw11CntlRHRP.cpp b/tools/src/librw11/Rw11CntlRHRP.cpp index 789aaad4..daff3834 100644 --- a/tools/src/librw11/Rw11CntlRHRP.cpp +++ b/tools/src/librw11/Rw11CntlRHRP.cpp @@ -1,6 +1,6 @@ -// $Id: Rw11CntlRHRP.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11CntlRHRP.cpp 1062 2018-10-28 11:14:20Z mueller $ // -// Copyright 2015-2017 by Walter F.J. Mueller +// Copyright 2015-2018 by Walter F.J. Mueller // Other credits: // the boot code is from the simh project and Copyright Robert M Supnik // @@ -15,6 +15,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-10-28 1062 1.0.6 replace boost/foreach // 2017-04-02 865 1.0.5 Dump(): add detail arg // 2017-03-03 858 1.0.4 use cntl name as message prefix // 2015-12-28 720 1.0.3 use octal for er1= printouts @@ -30,8 +31,6 @@ */ #include "boost/bind.hpp" -#include "boost/foreach.hpp" -#define foreach_ BOOST_FOREACH #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" @@ -352,7 +351,7 @@ bool Rw11CntlRHRP::BootCode(size_t unit, std::vector& code, }; code.clear(); - foreach_ (uint16_t& w, bootcode) code.push_back(w); + code.insert(code.end(), std::begin(bootcode), std::end(bootcode)); aload = kBOOT_START; astart = kBOOT_START+2; return true; diff --git a/tools/src/librw11/Rw11CntlRK11.cpp b/tools/src/librw11/Rw11CntlRK11.cpp index e4213818..0ed36042 100644 --- a/tools/src/librw11/Rw11CntlRK11.cpp +++ b/tools/src/librw11/Rw11CntlRK11.cpp @@ -1,6 +1,6 @@ -// $Id: Rw11CntlRK11.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11CntlRK11.cpp 1062 2018-10-28 11:14:20Z mueller $ // -// Copyright 2013-2017 by Walter F.J. Mueller +// Copyright 2013-2018 by Walter F.J. Mueller // Other credits: // the boot code is from the simh project and Copyright Robert M Supnik // @@ -15,6 +15,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-10-28 1062 2.0.6 replace boost/foreach // 2017-04-02 865 2.0.5 Dump(): add detail arg // 2017-03-03 858 2.0.4 use cntl name as message prefix // 2017-02-26 857 2.0.3 use kCPAH_M_UBM22 @@ -34,8 +35,6 @@ */ #include "boost/bind.hpp" -#include "boost/foreach.hpp" -#define foreach_ BOOST_FOREACH #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" @@ -282,7 +281,7 @@ bool Rw11CntlRK11::BootCode(size_t unit, std::vector& code, }; code.clear(); - foreach_ (uint16_t& w, bootcode) code.push_back(w); + code.insert(code.end(), std::begin(bootcode), std::end(bootcode)); aload = kBOOT_START; astart = kBOOT_START+2; return true; diff --git a/tools/src/librw11/Rw11CntlRL11.cpp b/tools/src/librw11/Rw11CntlRL11.cpp index e550be24..b74d5f4c 100644 --- a/tools/src/librw11/Rw11CntlRL11.cpp +++ b/tools/src/librw11/Rw11CntlRL11.cpp @@ -1,6 +1,6 @@ -// $Id: Rw11CntlRL11.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11CntlRL11.cpp 1062 2018-10-28 11:14:20Z mueller $ // -// Copyright 2014-2017 by Walter F.J. Mueller +// Copyright 2014-2018 by Walter F.J. Mueller // Other credits: // the boot code is from the simh project and Copyright Robert M Supnik // CalcCrc() is adopted from the simh project and Copyright Robert M Supnik @@ -16,6 +16,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-10-28 1062 1.0.6 replace boost/foreach // 2017-04-02 865 1.0.5 Dump(): add detail arg // 2017-03-03 858 1.0.4 use cntl name as message prefix // 2017-02-26 857 1.0.3 use kCPAH_M_UBM22 @@ -31,8 +32,6 @@ */ #include "boost/bind.hpp" -#include "boost/foreach.hpp" -#define foreach_ BOOST_FOREACH #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" @@ -345,7 +344,7 @@ bool Rw11CntlRL11::BootCode(size_t unit, std::vector& code, }; code.clear(); - foreach_ (uint16_t& w, bootcode) code.push_back(w); + code.insert(code.end(), std::begin(bootcode), std::end(bootcode)); aload = kBOOT_START; astart = kBOOT_START+2; return true; diff --git a/tools/src/librw11/Rw11CntlTM11.cpp b/tools/src/librw11/Rw11CntlTM11.cpp index e67c3246..c05d4593 100644 --- a/tools/src/librw11/Rw11CntlTM11.cpp +++ b/tools/src/librw11/Rw11CntlTM11.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11CntlTM11.cpp 1049 2018-09-22 13:56:52Z mueller $ +// $Id: Rw11CntlTM11.cpp 1062 2018-10-28 11:14:20Z mueller $ // // Copyright 2015-2018 by Walter F.J. Mueller // Other credits: @@ -15,6 +15,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-10-28 1062 1.0.5 replace boost/foreach // 2017-04-02 865 1.0.4 Dump(): add detail arg // 2017-03-03 858 1.0.3 use cntl name as message prefix // 2017-02-26 857 1.0.2 use kCPAH_M_UBM22 @@ -29,8 +30,6 @@ */ #include "boost/bind.hpp" -#include "boost/foreach.hpp" -#define foreach_ BOOST_FOREACH #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" @@ -265,7 +264,7 @@ bool Rw11CntlTM11::BootCode(size_t unit, std::vector& code, }; code.clear(); - foreach_ (uint16_t& w, bootcode) code.push_back(w); + code.insert(code.end(), std::begin(bootcode), std::end(bootcode)); aload = kBOOT_START; astart = kBOOT_START+2; return true;