From 4e1f91b0a111223aba27abea1646397634974b0c Mon Sep 17 00:00:00 2001 From: wfjm Date: Fri, 16 Nov 2018 18:26:00 +0100 Subject: [PATCH] use auto; use emplace,make_pair --- tools/src/librlink/ReventLoop.cpp | 5 +++-- tools/src/librlink/RlinkAddrMap.cpp | 21 ++++++++++--------- tools/src/librlink/RlinkAddrMap.hpp | 8 +------- tools/src/librlink/RlinkPortCuff.cpp | 5 +++-- tools/src/librlinktpp/RtclRlinkConnect.cpp | 7 ++++--- tools/src/librlinktpp/RtclRlinkServer.cpp | 17 +++++++-------- tools/src/librtcltools/RtclCmdBase.cpp | 7 ++++--- tools/src/librtcltools/RtclCmdBase.hpp | 3 +-- tools/src/librtcltools/RtclContext.cpp | 24 ++++++++++------------ tools/src/librtcltools/RtclContext.hpp | 6 +----- tools/src/librtcltools/RtclGetList.cpp | 16 +++++++-------- tools/src/librtcltools/RtclGetList.hpp | 5 +---- tools/src/librtcltools/RtclNameSet.cpp | 15 +++++++------- tools/src/librtcltools/RtclSetList.cpp | 16 +++++++-------- tools/src/librtcltools/RtclSetList.hpp | 5 +---- tools/src/librtools/RlogFileCatalog.cpp | 11 +++++----- tools/src/librtools/RlogFileCatalog.hpp | 5 +---- tools/src/librtools/RparseUrl.cpp | 13 ++++++------ tools/src/librtools/RparseUrl.hpp | 5 +---- tools/src/librw11/Rw11Cpu.cpp | 22 +++++++++----------- tools/src/librw11/Rw11Cpu.hpp | 6 +----- tools/src/librw11/Rw11VirtDiskOver.hpp | 5 +---- tools/src/librw11/Rw11VirtDiskRam.hpp | 5 +---- tools/src/librwxxtpp/RtclRw11Cpu.cpp | 19 ++++++++--------- 24 files changed, 110 insertions(+), 141 deletions(-) diff --git a/tools/src/librlink/ReventLoop.cpp b/tools/src/librlink/ReventLoop.cpp index 6cb11f22..0726e962 100644 --- a/tools/src/librlink/ReventLoop.cpp +++ b/tools/src/librlink/ReventLoop.cpp @@ -1,4 +1,4 @@ -// $Id: ReventLoop.cpp 1049 2018-09-22 13:56:52Z mueller $ +// $Id: ReventLoop.cpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.2.2 use emplace_back // 2017-04-07 868 1.2.1 Dump(): add detail arg // 2015-04-04 662 1.2 BUGFIX: fix race in Stop(), add UnStop,StopPending // 2013-04-27 511 1.1.3 BUGFIX: logic in DoCall() fixed (loop range) @@ -90,7 +91,7 @@ void ReventLoop::AddPollHandler(const pollhdl_t& pollhdl, } } - fPollDsc.push_back(PollDsc(pollhdl,fd,events)); + fPollDsc.emplace_back(PollDsc(pollhdl,fd,events)); fUpdatePoll = true; if (fspLog && fTraceLevel >= 1) { diff --git a/tools/src/librlink/RlinkAddrMap.cpp b/tools/src/librlink/RlinkAddrMap.cpp index e53cf4f4..59b6350a 100644 --- a/tools/src/librlink/RlinkAddrMap.cpp +++ b/tools/src/librlink/RlinkAddrMap.cpp @@ -1,6 +1,6 @@ -// $Id: RlinkAddrMap.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RlinkAddrMap.cpp 1066 2018-11-10 11:21:53Z mueller $ // -// Copyright 2011-2017 by Walter F.J. Mueller +// Copyright 2011-2018 by Walter F.J. Mueller // // This program is free software; you may redistribute and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.0.4 use auto; use emplace,make_pair // 2017-04-07 868 1.0.3 Dump(): add detail arg // 2013-02-03 481 1.0.2 use Rexception // 2011-11-28 434 1.0.1 Print(): use proper cast for lp64 compatibility @@ -76,8 +77,8 @@ bool RlinkAddrMap::Insert(const std::string& name, uint16_t addr) if (fNameMap.find(name) != fNameMap.end()) return false; if (fAddrMap.find(addr) != fAddrMap.end()) return false; - fNameMap.insert(nmap_val_t(name, addr)); - fAddrMap.insert(amap_val_t(addr, name)); + fNameMap.emplace(make_pair(name, addr)); + fAddrMap.emplace(make_pair(addr, name)); fMaxLength = max(fMaxLength, name.length()); return true; @@ -88,7 +89,7 @@ bool RlinkAddrMap::Insert(const std::string& name, uint16_t addr) bool RlinkAddrMap::Erase(const std::string& name) { - nmap_cit_t it = fNameMap.find(name); + auto it = fNameMap.find(name); if (it == fNameMap.end()) return false; fMaxLength = 0; // force recalculate @@ -107,7 +108,7 @@ bool RlinkAddrMap::Erase(const std::string& name) bool RlinkAddrMap::Erase(uint16_t addr) { - amap_cit_t it = fAddrMap.find(addr); + auto it = fAddrMap.find(addr); if (it == fAddrMap.end()) return false; fMaxLength = 0; // force recalculate @@ -126,7 +127,7 @@ bool RlinkAddrMap::Erase(uint16_t addr) bool RlinkAddrMap::Find(const std::string& name, uint16_t& addr) const { - nmap_cit_t it = fNameMap.find(name); + auto it = fNameMap.find(name); if (it == fNameMap.end()) return false; addr = it->second; @@ -139,7 +140,7 @@ bool RlinkAddrMap::Find(const std::string& name, uint16_t& addr) const bool RlinkAddrMap::Find(uint16_t addr, std::string& name) const { - amap_cit_t it = fAddrMap.find(addr); + auto it = fAddrMap.find(addr); if (it == fAddrMap.end()) return false; name = it->second; @@ -153,7 +154,7 @@ bool RlinkAddrMap::Find(uint16_t addr, std::string& name) const size_t RlinkAddrMap::MaxNameLength() const { if (fMaxLength == 0) { - for (amap_cit_t it=fAddrMap.begin(); it!=fAddrMap.end(); it++) { + for (auto it=fAddrMap.begin(); it!=fAddrMap.end(); it++) { fMaxLength = max(fMaxLength, (it->second).length()); } } @@ -168,7 +169,7 @@ void RlinkAddrMap::Print(std::ostream& os, int ind) const size_t maxlen = max(((size_t) 6), MaxNameLength()); RosFill bl(ind); - for (amap_cit_t it=fAddrMap.begin(); it!=fAddrMap.end(); it++) { + for (auto it=fAddrMap.begin(); it!=fAddrMap.end(); it++) { os << bl << RosPrintf((it->second).c_str(), "-s",maxlen) << " : " << RosPrintf(it->first, "$x0", 6) << " " << RosPrintf(it->first, "o0", 6) << endl; diff --git a/tools/src/librlink/RlinkAddrMap.hpp b/tools/src/librlink/RlinkAddrMap.hpp index 9b3fb830..d18ca0f8 100644 --- a/tools/src/librlink/RlinkAddrMap.hpp +++ b/tools/src/librlink/RlinkAddrMap.hpp @@ -1,4 +1,4 @@ -// $Id: RlinkAddrMap.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RlinkAddrMap.hpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2011-2017 by Walter F.J. Mueller // @@ -36,13 +36,7 @@ namespace Retro { class RlinkAddrMap { public: typedef std::map nmap_t; - typedef nmap_t::iterator nmap_it_t; - typedef nmap_t::const_iterator nmap_cit_t; - typedef nmap_t::value_type nmap_val_t; typedef std::map amap_t; - typedef amap_t::iterator amap_it_t; - typedef amap_t::const_iterator amap_cit_t; - typedef amap_t::value_type amap_val_t; RlinkAddrMap(); ~RlinkAddrMap(); diff --git a/tools/src/librlink/RlinkPortCuff.cpp b/tools/src/librlink/RlinkPortCuff.cpp index 66296857..9d22dfe9 100644 --- a/tools/src/librlink/RlinkPortCuff.cpp +++ b/tools/src/librlink/RlinkPortCuff.cpp @@ -1,4 +1,4 @@ -// $Id: RlinkPortCuff.cpp 1060 2018-10-27 11:32:39Z mueller $ +// $Id: RlinkPortCuff.cpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2012-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.1.7 use auto // 2018-10-27 1059 1.1.6 coverity fixup (uncaught exception in dtor) // 2017-04-15 875 1.1.5 Open(): set default scheme // 2017-03-04 858 1.1.4 use clock_gettime instead of gettimeofday @@ -235,7 +236,7 @@ bool RlinkPortCuff::Open(const std::string& url, RerrMsg& emsg) // 2. libusb callbacks const libusb_pollfd** plist = libusb_get_pollfds(fpUsbContext); - for (const libusb_pollfd** p = plist; *p !=0; p++) { + for (auto p = plist; *p !=0; p++) { PollfdAdd((*p)->fd, (*p)->events); } ::free(plist); diff --git a/tools/src/librlinktpp/RtclRlinkConnect.cpp b/tools/src/librlinktpp/RtclRlinkConnect.cpp index 1624d785..2698b77d 100644 --- a/tools/src/librlinktpp/RtclRlinkConnect.cpp +++ b/tools/src/librlinktpp/RtclRlinkConnect.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRlinkConnect.cpp 1048 2018-09-22 07:41:46Z mueller $ +// $Id: RtclRlinkConnect.cpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2011-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.6.2 use auto // 2018-09-16 1047 1.6.1 coverity fixup (uninitialized scalar) // 2017-04-29 888 1.6 drop M_rawio; add M_rawread,M_rawrblk,M_rawwblk // 2017-04-22 883 1.5.2 M_amap: -testname opt addr check; add hasrbmon get @@ -538,8 +539,8 @@ int RtclRlinkConnect::M_amap(RtclArgs& args) } else { // amap RtclOPtr plist(Tcl_NewListObj(0, nullptr)); - const RlinkAddrMap::amap_t amap = addrmap.Amap(); - for (RlinkAddrMap::amap_cit_t it=amap.begin(); it!=amap.end(); it++) { + const auto amap = addrmap.Amap(); + for (auto it=amap.begin(); it!=amap.end(); it++) { Tcl_Obj* tpair[2]; tpair[0] = Tcl_NewIntObj(it->first); tpair[1] = Tcl_NewStringObj((it->second).c_str(),(it->second).length()); diff --git a/tools/src/librlinktpp/RtclRlinkServer.cpp b/tools/src/librlinktpp/RtclRlinkServer.cpp index 1697b68e..a7afc259 100644 --- a/tools/src/librlinktpp/RtclRlinkServer.cpp +++ b/tools/src/librlinktpp/RtclRlinkServer.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRlinkServer.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclRlinkServer.cpp 1066 2018-11-10 11:21:53Z mueller $ // -// Copyright 2013-2017 by Walter F.J. Mueller +// Copyright 2013-2018 by Walter F.J. Mueller // // This program is free software; you may redistribute and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.1.2 use auto // 2017-04-02 865 1.1.1 M_dump: use GetArgsDump and Dump detail // 2015-04-04 662 1.1 add M_get, M_set; remove 'server -trace' // 2014-08-22 584 1.0.6 use nullptr @@ -105,7 +106,7 @@ RtclRlinkServer::RtclRlinkServer(Tcl_Interp* interp, const char* name) RtclRlinkServer::~RtclRlinkServer() { - for (alist_it_t it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) { + for (auto it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) { delete (*it); } } @@ -196,7 +197,7 @@ int RtclRlinkServer::M_attn(RtclArgs& args) uint16_t mask=0; if (!args.GetArg("mask", mask)) return kERR; if (!args.AllDone()) return kERR; - for (alist_it_t it = fAttnHdl.end(); it != fAttnHdl.begin(); ) { + for (auto it = fAttnHdl.end(); it != fAttnHdl.begin(); ) { it--; if ((*it)->Mask() == mask) { fAttnHdl.erase(it); @@ -212,7 +213,7 @@ int RtclRlinkServer::M_attn(RtclArgs& args) if (!args.GetArg("mask", mask)) return kERR; if (!args.AllDone()) return kERR; RtclOPtr pres(Tcl_NewListObj(0,nullptr)); - for (alist_it_t it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) { + for (auto it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) { if ((*it)->Mask() & mask) { RtclOPtr pele(Tcl_NewListObj(0,nullptr)); Tcl_ListObjAppendElement(nullptr, pele, @@ -229,7 +230,7 @@ int RtclRlinkServer::M_attn(RtclArgs& args) if (!args.GetArg("mask", mask)) return kERR; if (!args.AllDone()) return kERR; int nhdl = 0; - for (alist_it_t it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) { + for (auto it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) { if ((*it)->Mask() & mask) { nhdl += 1; int rc = Tcl_EvalObjEx(interp, (*it)->Script(), TCL_EVAL_GLOBAL); @@ -243,7 +244,7 @@ int RtclRlinkServer::M_attn(RtclArgs& args) } else if (opt == "-list") { // attn -list if (!args.AllDone()) return kERR; vector vres; - for (alist_it_t it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) { + for (auto it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) { vres.push_back((*it)->Mask()); } args.SetResult(Rtcl::NewListIntObj(vres)); @@ -253,7 +254,7 @@ int RtclRlinkServer::M_attn(RtclArgs& args) if (!args.OptValid()) return kERR; if (!args.AllDone()) return kERR; uint16_t mask=0; - for (alist_it_t it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) { + for (auto it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) { mask |= (*it)->Mask(); } args.SetResult(mask); diff --git a/tools/src/librtcltools/RtclCmdBase.cpp b/tools/src/librtcltools/RtclCmdBase.cpp index 3209d047..e97ef22a 100644 --- a/tools/src/librtcltools/RtclCmdBase.cpp +++ b/tools/src/librtcltools/RtclCmdBase.cpp @@ -1,4 +1,4 @@ -// $Id: RtclCmdBase.cpp 1048 2018-09-22 07:41:46Z mueller $ +// $Id: RtclCmdBase.cpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2011-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.1.2 use auto // 2017-04-02 865 1.1.1 add GetArgsDump() // 2017-04-02 863 1.1 add DelMeth(),TstMeth(); add M_info() and '?' // rename fMapMeth -> fMethMap @@ -96,7 +97,7 @@ int RtclCmdBase::DispatchCmd(RtclArgs& args) if (it_match==fMethMap.end() || name!=it_match->first.substr(0,name.length())) { - mmap_cit_t it_un = fMethMap.find("$unknown"); // unknown method registered ? + auto it_un = fMethMap.find("$unknown"); // unknown method registered ? if (it_un!=fMethMap.end()) { return (it_un->second)(args); } @@ -115,7 +116,7 @@ int RtclCmdBase::DispatchCmd(RtclArgs& args) // check for ambiguous substring match if (name != it_match->first) { - mmap_cit_t it1 = it_match; + auto it1 = it_match; it1++; if (it1!=fMethMap.end() && name==it1->first.substr(0,name.length())) { Tcl_AppendResult(interp, "-E: ambiguous option '", diff --git a/tools/src/librtcltools/RtclCmdBase.hpp b/tools/src/librtcltools/RtclCmdBase.hpp index a698c802..1c92ddd0 100644 --- a/tools/src/librtcltools/RtclCmdBase.hpp +++ b/tools/src/librtcltools/RtclCmdBase.hpp @@ -1,4 +1,4 @@ -// $Id: RtclCmdBase.hpp 1052 2018-09-30 08:10:52Z mueller $ +// $Id: RtclCmdBase.hpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -47,7 +47,6 @@ namespace Retro { typedef std::map mmap_t; typedef mmap_t::iterator mmap_it_t; typedef mmap_t::const_iterator mmap_cit_t; - typedef mmap_t::value_type mmap_val_t; RtclCmdBase(); virtual ~RtclCmdBase(); diff --git a/tools/src/librtcltools/RtclContext.cpp b/tools/src/librtcltools/RtclContext.cpp index 1a9a46c6..0b37dc11 100644 --- a/tools/src/librtcltools/RtclContext.cpp +++ b/tools/src/librtcltools/RtclContext.cpp @@ -1,6 +1,6 @@ -// $Id: RtclContext.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclContext.cpp 1066 2018-11-10 11:21:53Z mueller $ // -// Copyright 2011-2017 by Walter F.J. Mueller +// Copyright 2011-2018 by Walter F.J. Mueller // // This program is free software; you may redistribute and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.0.5 use auto; use emplace,make_pair // 2017-02-04 866 1.0.4 rename fMapContext -> fContextMap // 2013-02-03 481 1.0.3 use Rexception // 2013-01-12 474 1.0.2 add FindProxy() method @@ -42,9 +43,6 @@ using namespace std; // all method definitions in namespace Retro namespace Retro { -typedef std::pair cset_ins_t; -typedef std::pair pset_ins_t; - RtclContext::xmap_t RtclContext::fContextMap; //------------------------------------------+----------------------------------- @@ -67,7 +65,7 @@ RtclContext::~RtclContext() void RtclContext::RegisterClass(RtclClassBase* pobj) { - cset_ins_t ret = fSetClass.insert(pobj); + auto ret = fSetClass.insert(pobj); if (ret.second == false) // or use !(ret.second) throw Rexception("RtclContext::RegisterClass()", "Bad args: duplicate pointer"); @@ -88,7 +86,7 @@ void RtclContext::UnRegisterClass(RtclClassBase* pobj) void RtclContext::RegisterProxy(RtclProxyBase* pobj) { - pset_ins_t ret = fSetProxy.insert(pobj); + auto ret = fSetProxy.insert(pobj); if (ret.second == false) // or use !(ret.second) throw Rexception("RtclContext::RegisterProxy()", "Bad args: duplicate pointer"); @@ -109,7 +107,7 @@ void RtclContext::UnRegisterProxy(RtclProxyBase* pobj) bool RtclContext::CheckProxy(RtclProxyBase* pobj) { - pset_it_t it = fSetProxy.find(pobj); + auto it = fSetProxy.find(pobj); return it != fSetProxy.end(); } @@ -118,7 +116,7 @@ bool RtclContext::CheckProxy(RtclProxyBase* pobj) bool RtclContext::CheckProxy(RtclProxyBase* pobj, const string& type) { - pset_it_t it = fSetProxy.find(pobj); + auto it = fSetProxy.find(pobj); if (it == fSetProxy.end()) return false; return (*it)->Type() == type; } @@ -130,7 +128,7 @@ void RtclContext::ListProxy(std::vector& list, const std::string& type) { list.clear(); - for (pset_it_t it = fSetProxy.begin(); it != fSetProxy.end(); it++) { + for (auto it = fSetProxy.begin(); it != fSetProxy.end(); it++) { if (type.length() == 0 || (*it)->Type()==type) { list.push_back(*it); } @@ -144,7 +142,7 @@ void RtclContext::ListProxy(std::vector& list, RtclProxyBase* RtclContext::FindProxy(const std::string& type, const std::string& name) { - for (pset_it_t it = fSetProxy.begin(); it != fSetProxy.end(); it++) { + for (auto it = fSetProxy.begin(); it != fSetProxy.end(); it++) { if (type.length() == 0 || (*it)->Type()==type) { const char* cmdname = Tcl_GetCommandName(fInterp, (*it)->Token()); if (name == cmdname) return *it; @@ -159,12 +157,12 @@ RtclProxyBase* RtclContext::FindProxy(const std::string& type, RtclContext& RtclContext::Find(Tcl_Interp* interp) { RtclContext* pcntx = 0; - xmap_it_t it = fContextMap.find(interp); + auto it = fContextMap.find(interp); if (it != fContextMap.end()) { pcntx = it->second; } else { pcntx = new RtclContext(interp); - fContextMap.insert(xmap_val_t(interp, pcntx)); + fContextMap.emplace(make_pair(interp, pcntx)); Tcl_CreateExitHandler((Tcl_ExitProc*) ThunkTclExitProc, (ClientData) pcntx); } diff --git a/tools/src/librtcltools/RtclContext.hpp b/tools/src/librtcltools/RtclContext.hpp index 5e9da660..8d668821 100644 --- a/tools/src/librtcltools/RtclContext.hpp +++ b/tools/src/librtcltools/RtclContext.hpp @@ -1,4 +1,4 @@ -// $Id: RtclContext.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclContext.hpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2011-2017 by Walter F.J. Mueller // @@ -45,12 +45,8 @@ namespace Retro { class RtclContext : private boost::noncopyable { public: typedef std::set cset_t; - typedef cset_t::iterator cset_it_t; typedef std::set pset_t; - typedef pset_t::iterator pset_it_t; typedef std::map xmap_t; - typedef xmap_t::iterator xmap_it_t; - typedef xmap_t::value_type xmap_val_t; explicit RtclContext(Tcl_Interp* interp); virtual ~RtclContext(); diff --git a/tools/src/librtcltools/RtclGetList.cpp b/tools/src/librtcltools/RtclGetList.cpp index f6dffbdf..c2e4b119 100644 --- a/tools/src/librtcltools/RtclGetList.cpp +++ b/tools/src/librtcltools/RtclGetList.cpp @@ -1,6 +1,6 @@ -// $Id: RtclGetList.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclGetList.cpp 1066 2018-11-10 11:21:53Z mueller $ // -// Copyright 2013-2015 by Walter F.J. Mueller +// Copyright 2013-2018 by Walter F.J. Mueller // // This program is free software; you may redistribute and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.1.1 use auto; use emplace,make_pair // 2015-01-08 631 1.1 add Clear(), add '?' (key list) and '*' (kv list) // 2014-08-22 584 1.0.1 use nullptr // 2013-02-12 487 1.0 Initial version @@ -53,7 +54,7 @@ RtclGetList::RtclGetList() RtclGetList::~RtclGetList() { - for (map_cit_t it=fMap.begin(); it != fMap.end(); it++) { + for (auto it=fMap.begin(); it != fMap.end(); it++) { delete (it->second); } } @@ -63,8 +64,7 @@ RtclGetList::~RtclGetList() void RtclGetList::Add(const std::string& name, RtclGetBase* pget) { - typedef std::pair map_ins_t; - map_ins_t ret = fMap.insert(map_val_t(name, pget)); + auto ret = fMap.emplace(make_pair(name, pget)); if (ret.second == false) throw Rexception("RtclGetList::Add:", string("Bad args: duplicate name: '") + name + "'"); @@ -110,14 +110,14 @@ int RtclGetList::M_get(RtclArgs& args) return TCL_OK; } - map_cit_t it = fMap.lower_bound(pname); + auto it = fMap.lower_bound(pname); // complain if not found if (it == fMap.end() || pname != it->first.substr(0,pname.length())) { Tcl_AppendResult(interp, "-E: unknown property '", pname.c_str(), "': must be ", nullptr); const char* delim = ""; - for (map_cit_t it1=fMap.begin(); it1!=fMap.end(); it1++) { + for (auto it1=fMap.begin(); it1!=fMap.end(); it1++) { Tcl_AppendResult(interp, delim, it1->first.c_str(), nullptr); delim = ","; } @@ -125,7 +125,7 @@ int RtclGetList::M_get(RtclArgs& args) } // check for ambiguous substring match - map_cit_t it1 = it; + auto it1 = it; it1++; if (it1!=fMap.end() && pname==it1->first.substr(0,pname.length())) { Tcl_AppendResult(interp, "-E: ambiguous property name '", pname.c_str(), diff --git a/tools/src/librtcltools/RtclGetList.hpp b/tools/src/librtcltools/RtclGetList.hpp index b39c3b5e..e6b611ae 100644 --- a/tools/src/librtcltools/RtclGetList.hpp +++ b/tools/src/librtcltools/RtclGetList.hpp @@ -1,4 +1,4 @@ -// $Id: RtclGetList.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclGetList.hpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2013-2015 by Walter F.J. Mueller // @@ -55,9 +55,6 @@ namespace Retro { protected: typedef std::map map_t; - typedef map_t::iterator map_it_t; - typedef map_t::const_iterator map_cit_t; - typedef map_t::value_type map_val_t; map_t fMap; }; diff --git a/tools/src/librtcltools/RtclNameSet.cpp b/tools/src/librtcltools/RtclNameSet.cpp index 3bef3e0c..48181743 100644 --- a/tools/src/librtcltools/RtclNameSet.cpp +++ b/tools/src/librtcltools/RtclNameSet.cpp @@ -1,6 +1,6 @@ -// $Id: RtclNameSet.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclNameSet.cpp 1066 2018-11-10 11:21:53Z mueller $ // -// Copyright 2011-2014 by Walter F.J. Mueller +// Copyright 2011-2018 by Walter F.J. Mueller // // This program is free software; you may redistribute and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.1.2 use auto // 2014-08-22 584 1.1.1 use nullptr // 2013-05-19 521 1.1 add CheckMatch() // 2013-02-03 481 1.0.1 use Rexception @@ -41,8 +42,6 @@ using namespace std; // all method definitions in namespace Retro namespace Retro { -typedef std::pair nset_ins_t; - //------------------------------------------+----------------------------------- //! Default constructor @@ -61,7 +60,7 @@ RtclNameSet::RtclNameSet(const std::string& nset) size_t iend = nset.find_first_of('|', ibeg); if (iend-ibeg > 0) { string name(nset, ibeg, iend-ibeg); - nset_ins_t ret = fSet.insert(name); + auto ret = fSet.insert(name); if (ret.second == false) // or use !(ret.second) throw Rexception("RtclNameSet::", "Bad args: " + string("duplicate name '") + name + @@ -97,7 +96,7 @@ int RtclNameSet::CheckMatch(Tcl_Interp* interp, std::string& rval, const std::string& tval, bool misserr) const { rval.clear(); - nset_cit_t it = fSet.lower_bound(tval); + auto it = fSet.lower_bound(tval); // no leading substring match if (it==fSet.end() || tval!=it->substr(0,tval.length())) { @@ -105,7 +104,7 @@ int RtclNameSet::CheckMatch(Tcl_Interp* interp, std::string& rval, Tcl_AppendResult(interp, "-E: bad option '", tval.c_str(), "': must be ", nullptr); const char* delim = ""; - for (nset_cit_t it1=fSet.begin(); it1!=fSet.end(); it1++) { + for (auto it1=fSet.begin(); it1!=fSet.end(); it1++) { Tcl_AppendResult(interp, delim, it1->c_str(), nullptr); delim = ","; } @@ -115,7 +114,7 @@ int RtclNameSet::CheckMatch(Tcl_Interp* interp, std::string& rval, // check for ambiguous substring match if (tval != *it) { - nset_cit_t it1 = it; + auto it1 = it; it1++; if (it1!=fSet.end() && tval==it1->substr(0,tval.length())) { Tcl_AppendResult(interp, "-E: ambiguous option '", tval.c_str(), diff --git a/tools/src/librtcltools/RtclSetList.cpp b/tools/src/librtcltools/RtclSetList.cpp index b267138f..28c5bbae 100644 --- a/tools/src/librtcltools/RtclSetList.cpp +++ b/tools/src/librtcltools/RtclSetList.cpp @@ -1,6 +1,6 @@ -// $Id: RtclSetList.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclSetList.cpp 1066 2018-11-10 11:21:53Z mueller $ // -// Copyright 2013-2015 by Walter F.J. Mueller +// Copyright 2013-2018 by Walter F.J. Mueller // // This program is free software; you may redistribute and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.1.1 use auto; use emplace,make_pair // 2015-01-08 631 1.1 add Clear(), add '?' (key list) // 2014-08-22 584 1.0.1 use nullptr // 2013-02-12 487 1.0 Initial version @@ -53,7 +54,7 @@ RtclSetList::RtclSetList() RtclSetList::~RtclSetList() { - for (map_cit_t it=fMap.begin(); it != fMap.end(); it++) { + for (auto it=fMap.begin(); it != fMap.end(); it++) { delete (it->second); } } @@ -63,8 +64,7 @@ RtclSetList::~RtclSetList() void RtclSetList::Add(const std::string& name, RtclSetBase* pset) { - typedef std::pair map_ins_t; - map_ins_t ret = fMap.insert(map_val_t(name, pset)); + auto ret = fMap.emplace(make_pair(name, pset)); if (ret.second == false) throw Rexception("RtclSetList::Add:", string("Bad args: duplicate name: '") + name + "'"); @@ -100,14 +100,14 @@ int RtclSetList::M_set(RtclArgs& args) return TCL_OK; } - map_cit_t it = fMap.lower_bound(pname); + auto it = fMap.lower_bound(pname); // complain if not found if (it == fMap.end() || pname != it->first.substr(0,pname.length())) { Tcl_AppendResult(interp, "-E: unknown property '", pname.c_str(), "': must be ", nullptr); const char* delim = ""; - for (map_cit_t it1=fMap.begin(); it1!=fMap.end(); it1++) { + for (auto it1=fMap.begin(); it1!=fMap.end(); it1++) { Tcl_AppendResult(interp, delim, it1->first.c_str(), nullptr); delim = ","; } @@ -115,7 +115,7 @@ int RtclSetList::M_set(RtclArgs& args) } // check for ambiguous substring match - map_cit_t it1 = it; + auto it1 = it; it1++; if (it1!=fMap.end() && pname==it1->first.substr(0,pname.length())) { Tcl_AppendResult(interp, "-E: ambiguous property name '", pname.c_str(), diff --git a/tools/src/librtcltools/RtclSetList.hpp b/tools/src/librtcltools/RtclSetList.hpp index a236244b..b7e3b30b 100644 --- a/tools/src/librtcltools/RtclSetList.hpp +++ b/tools/src/librtcltools/RtclSetList.hpp @@ -1,4 +1,4 @@ -// $Id: RtclSetList.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclSetList.hpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2013-2015 by Walter F.J. Mueller // @@ -55,9 +55,6 @@ namespace Retro { protected: typedef std::map map_t; - typedef map_t::iterator map_it_t; - typedef map_t::const_iterator map_cit_t; - typedef map_t::value_type map_val_t; map_t fMap; }; diff --git a/tools/src/librtools/RlogFileCatalog.cpp b/tools/src/librtools/RlogFileCatalog.cpp index 2357158c..9ddf2f2a 100644 --- a/tools/src/librtools/RlogFileCatalog.cpp +++ b/tools/src/librtools/RlogFileCatalog.cpp @@ -1,6 +1,6 @@ -// $Id: RlogFileCatalog.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RlogFileCatalog.cpp 1066 2018-11-10 11:21:53Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2018 by Walter F.J. Mueller // // This program is free software; you may redistribute and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.0.1 use auto; use make_pair,emplace // 2013-02-22 491 1.0 Initial version // --------------------------------------------------------------------------- @@ -50,13 +51,13 @@ RlogFileCatalog& RlogFileCatalog::Obj() const boost::shared_ptr& RlogFileCatalog::FindOrCreate(const std::string& name) { - map_cit_t it = fMap.find(name); + auto it = fMap.find(name); if (it != fMap.end()) return it->second; boost::shared_ptr sptr(new RlogFile()); - it = fMap.insert(fMap.begin(), map_val_t(name, sptr)); + auto pitb = fMap.emplace(make_pair(name, sptr)); - return it->second; + return pitb.first->second; } //------------------------------------------+----------------------------------- diff --git a/tools/src/librtools/RlogFileCatalog.hpp b/tools/src/librtools/RlogFileCatalog.hpp index 1bbf4746..7088cc0d 100644 --- a/tools/src/librtools/RlogFileCatalog.hpp +++ b/tools/src/librtools/RlogFileCatalog.hpp @@ -1,4 +1,4 @@ -// $Id: RlogFileCatalog.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RlogFileCatalog.hpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2011-2013 by Walter F.J. Mueller // @@ -47,9 +47,6 @@ namespace Retro { protected: typedef std::map> map_t; - typedef map_t::iterator map_it_t; - typedef map_t::const_iterator map_cit_t; - typedef map_t::value_type map_val_t; map_t fMap; //!< name->rlogfile map }; diff --git a/tools/src/librtools/RparseUrl.cpp b/tools/src/librtools/RparseUrl.cpp index 002c7f4c..f9947ce7 100644 --- a/tools/src/librtools/RparseUrl.cpp +++ b/tools/src/librtools/RparseUrl.cpp @@ -1,6 +1,6 @@ -// $Id: RparseUrl.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RparseUrl.cpp 1066 2018-11-10 11:21:53Z mueller $ // -// Copyright 2013-2017 by Walter F.J. Mueller +// Copyright 2013-2018 by Walter F.J. Mueller // // This program is free software; you may redistribute and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-11-09 1066 1.1.1 use auto; use emplace,make_pair // 2017-04-15 875 1.1 add Set() with default scheme handling // 2015-06-04 686 1.0.2 Set(): add check that optlist is enclosed by '|' // 2013-02-23 492 1.0.1 add static FindScheme(); allow no or empty scheme @@ -163,7 +164,7 @@ void RparseUrl::Clear() bool RparseUrl::FindOpt(const std::string& name) const { - omap_cit_t it = fOptMap.find(name); + auto it = fOptMap.find(name); if (it == fOptMap.end()) return false; return true; } @@ -173,7 +174,7 @@ bool RparseUrl::FindOpt(const std::string& name) const bool RparseUrl::FindOpt(const std::string& name, std::string& value) const { - omap_cit_t it = fOptMap.find(name); + auto it = fOptMap.find(name); if (it == fOptMap.end()) return false; value = it->second; @@ -193,7 +194,7 @@ void RparseUrl::Dump(std::ostream& os, int ind, const char* text) const os << bl << " fScheme: " << fScheme << endl; os << bl << " fPath: " << fPath << endl; os << bl << " fOptMap: " << endl; - for (omap_cit_t it=fOptMap.begin(); it!=fOptMap.end(); it++) { + for (auto it=fOptMap.begin(); it!=fOptMap.end(); it++) { os << bl << " " << RosPrintf((it->first).c_str(), "-s",8) << " : " << it->second << endl; } @@ -236,7 +237,7 @@ bool RparseUrl::AddOpt(const std::string& key, const std::string& val, return false; } - fOptMap.insert(omap_val_t(key, hasval ? val : "1")); + fOptMap.emplace(make_pair(key, hasval ? val : "1")); return true; } diff --git a/tools/src/librtools/RparseUrl.hpp b/tools/src/librtools/RparseUrl.hpp index b51f9d24..7c2e8cef 100644 --- a/tools/src/librtools/RparseUrl.hpp +++ b/tools/src/librtools/RparseUrl.hpp @@ -1,4 +1,4 @@ -// $Id: RparseUrl.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RparseUrl.hpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -36,9 +36,6 @@ namespace Retro { class RparseUrl { public: typedef std::map omap_t; - typedef omap_t::iterator omap_it_t; - typedef omap_t::const_iterator omap_cit_t; - typedef omap_t::value_type omap_val_t; RparseUrl(); virtual ~RparseUrl(); diff --git a/tools/src/librw11/Rw11Cpu.cpp b/tools/src/librw11/Rw11Cpu.cpp index 3ffdee6f..ea79556e 100644 --- a/tools/src/librw11/Rw11Cpu.cpp +++ b/tools/src/librw11/Rw11Cpu.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11Cpu.cpp 1050 2018-09-23 15:46:42Z mueller $ +// $Id: Rw11Cpu.cpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2019-09-23 1050 1.2.14 add HasPcnt() +// 2018-11-09 1066 1.2.15 use auto; use emplace,make_pair +// 2018-09-23 1050 1.2.14 add HasPcnt() // 2018-09-22 1048 1.2.13 coverity fixup (drop unreachable code) // 2017-04-07 868 1.2.12 Dump(): add detail arg // 2017-02-26 857 1.2.11 add kCPAH_M_UBM22 @@ -233,7 +234,7 @@ void Rw11Cpu::AddCntl(const boost::shared_ptr& spcntl) throw Rexception("Rw11Cpu::AddCntl", "Bad state: duplicate controller name");; - fCntlMap.insert(cmap_val_t(name, spcntl)); + fCntlMap.emplace(make_pair(name, spcntl)); spcntl->SetCpu(this); return; } @@ -252,7 +253,7 @@ bool Rw11Cpu::TestCntl(const std::string& name) const void Rw11Cpu::ListCntl(std::vector& list) const { list.clear(); - for (cmap_cit_t it=fCntlMap.begin(); it!=fCntlMap.end(); it++) { + for (auto it=fCntlMap.begin(); it!=fCntlMap.end(); it++) { list.push_back((it->second)->Name()); } return; @@ -263,7 +264,7 @@ void Rw11Cpu::ListCntl(std::vector& list) const Rw11Cntl& Rw11Cpu::Cntl(const std::string& name) const { - cmap_cit_t it=fCntlMap.find(name); + auto it=fCntlMap.find(name); if (it == fCntlMap.end()) throw Rexception("Rw11Cpu::Cntl()", "Bad args: controller name '" + name + "' unknown"); @@ -275,7 +276,7 @@ Rw11Cntl& Rw11Cpu::Cntl(const std::string& name) const void Rw11Cpu::Start() { - for (cmap_cit_t it=fCntlMap.begin(); it!=fCntlMap.end(); it++) { + for (auto it=fCntlMap.begin(); it!=fCntlMap.end(); it++) { Rw11Cntl& cntl(*(it->second)); cntl.Probe(); if (cntl.ProbeStatus().Found() && cntl.Enable()) { @@ -551,9 +552,6 @@ bool Rw11Cpu::LoadAbs(const std::string& fname, RerrMsg& emsg, bool trace) }; typedef std::map obmap_t; - //typedef obmap_t::iterator obmap_it_t; - typedef obmap_t::const_iterator obmap_cit_t; - typedef obmap_t::value_type obmap_val_t; obmap_t oddbyte; // odd byte cache @@ -637,7 +635,7 @@ bool Rw11Cpu::LoadAbs(const std::string& fname, RerrMsg& emsg, bool trace) addr = ldaddr; word = 0; if ((addr & 0x01) == 1 && bytcnt > 6) { - obmap_cit_t it = oddbyte.find(addr); + auto it = oddbyte.find(addr); if (it != oddbyte.end()) { word = it->second; } else { @@ -683,7 +681,7 @@ bool Rw11Cpu::LoadAbs(const std::string& fname, RerrMsg& emsg, bool trace) } else { if ((addr & 0x01) == 1) { // high byte not yet seen data.push_back(word); // zero fill high byte - oddbyte.insert(obmap_val_t(addr,word)); // store even byte for later + oddbyte.emplace(make_pair(addr,word)); // store even byte for later } //cout << "+++2 " << RosPrintBvi(ldaddr,8) @@ -884,7 +882,7 @@ void Rw11Cpu::Dump(std::ostream& os, int ind, const char* text, os << bl << " fCpuAct: " << fCpuAct << endl; os << bl << " fCpuStat: " << RosPrintf(fCpuStat,"$x0",4) << endl; os << bl << " fCntlMap: " << endl; - for (cmap_cit_t it=fCntlMap.begin(); it!=fCntlMap.end(); it++) { + for (auto it=fCntlMap.begin(); it!=fCntlMap.end(); it++) { os << bl << " " << RosPrintf((it->first).c_str(), "-s",8) << " : " << it->second << endl; } diff --git a/tools/src/librw11/Rw11Cpu.hpp b/tools/src/librw11/Rw11Cpu.hpp index 8278f11f..e6d84796 100644 --- a/tools/src/librw11/Rw11Cpu.hpp +++ b/tools/src/librw11/Rw11Cpu.hpp @@ -1,4 +1,4 @@ -// $Id: Rw11Cpu.hpp 1050 2018-09-23 15:46:42Z mueller $ +// $Id: Rw11Cpu.hpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -67,10 +67,6 @@ namespace Retro { class Rw11Cpu : public Rbits, private boost::noncopyable { public: typedef std::map> cmap_t; - typedef cmap_t::iterator cmap_it_t; - typedef cmap_t::const_iterator cmap_cit_t; - typedef cmap_t::value_type cmap_val_t; - explicit Rw11Cpu(const std::string& type); virtual ~Rw11Cpu(); diff --git a/tools/src/librw11/Rw11VirtDiskOver.hpp b/tools/src/librw11/Rw11VirtDiskOver.hpp index d92eedc5..a8862df2 100644 --- a/tools/src/librw11/Rw11VirtDiskOver.hpp +++ b/tools/src/librw11/Rw11VirtDiskOver.hpp @@ -1,4 +1,4 @@ -// $Id: Rw11VirtDiskOver.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11VirtDiskOver.hpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2017- by Walter F.J. Mueller // @@ -39,9 +39,6 @@ namespace Retro { public: typedef std::map bmap_t; - typedef bmap_t::iterator bmap_it_t; - typedef bmap_t::const_iterator bmap_cit_t; - typedef bmap_t::value_type bmap_val_t; explicit Rw11VirtDiskOver(Rw11Unit* punit); ~Rw11VirtDiskOver(); diff --git a/tools/src/librw11/Rw11VirtDiskRam.hpp b/tools/src/librw11/Rw11VirtDiskRam.hpp index 2934ab32..9bfe9a38 100644 --- a/tools/src/librw11/Rw11VirtDiskRam.hpp +++ b/tools/src/librw11/Rw11VirtDiskRam.hpp @@ -1,4 +1,4 @@ -// $Id: Rw11VirtDiskRam.hpp 1063 2018-10-29 18:37:42Z mueller $ +// $Id: Rw11VirtDiskRam.hpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2018- by Walter F.J. Mueller // @@ -38,9 +38,6 @@ namespace Retro { public: typedef std::map bmap_t; - typedef bmap_t::iterator bmap_it_t; - typedef bmap_t::const_iterator bmap_cit_t; - typedef bmap_t::value_type bmap_val_t; explicit Rw11VirtDiskRam(Rw11Unit* punit); ~Rw11VirtDiskRam(); diff --git a/tools/src/librwxxtpp/RtclRw11Cpu.cpp b/tools/src/librwxxtpp/RtclRw11Cpu.cpp index 13c83844..b3ee6a17 100644 --- a/tools/src/librwxxtpp/RtclRw11Cpu.cpp +++ b/tools/src/librwxxtpp/RtclRw11Cpu.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11Cpu.cpp 1050 2018-09-23 15:46:42Z mueller $ +// $Id: RtclRw11Cpu.cpp 1066 2018-11-10 11:21:53Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2019-09-23 1050 1.2.18 add HasPcnt() +// 2018-11-09 1066 1.2.19 use auto; use emplace_back +// 2018-09-23 1050 1.2.18 add HasPcnt() // 2018-09-21 1048 1.2.18 coverity fixup (uninitialized scalar) // 2017-04-22 883 1.2.17 M_(imap|rmap): -testname optional addr check // 2017-04-15 876 1.2.16 add ControllerCommands() @@ -223,8 +224,8 @@ int RtclRw11Cpu::M_imap(RtclArgs& args) } else { // imap RtclOPtr plist(Tcl_NewListObj(0, nullptr)); - const RlinkAddrMap::amap_t amap = addrmap.Amap(); - for (RlinkAddrMap::amap_cit_t it=amap.begin(); it!=amap.end(); it++) { + const auto amap = addrmap.Amap(); + for (auto it=amap.begin(); it!=amap.end(); it++) { Tcl_Obj* tpair[2]; tpair[0] = Tcl_NewIntObj(it->first); tpair[1] = Tcl_NewStringObj((it->second).c_str(),(it->second).length()); @@ -328,8 +329,8 @@ int RtclRw11Cpu::M_rmap(RtclArgs& args) } else { // rmap RtclOPtr plist(Tcl_NewListObj(0, nullptr)); - const RlinkAddrMap::amap_t amap = lmap.Amap(); - for (RlinkAddrMap::amap_cit_t it=amap.begin(); it!=amap.end(); it++) { + const auto amap = lmap.Amap(); + for (auto it=amap.begin(); it!=amap.end(); it++) { Tcl_Obj* tpair[2]; tpair[0] = Tcl_NewIntObj(it->first); tpair[1] = Tcl_NewStringObj((it->second).c_str(),(it->second).length()); @@ -1069,8 +1070,6 @@ int RtclRw11Cpu::M_ldasm(RtclArgs& args) bool lstbodyseen = false; typedef map cmap_t; - typedef cmap_t::iterator cmap_it_t; - //typedef cmap_t::value_type cmap_val_t; cmap_t cmap; uint16_t dot = 0; @@ -1163,7 +1162,7 @@ int RtclRw11Cpu::M_ldasm(RtclArgs& args) dot = 0; RerrMsg emsg; - for (cmap_it_t it=cmap.begin(); it!=cmap.end(); it++) { + for (auto it=cmap.begin(); it!=cmap.end(); it++) { //cout << "+++2 mem[" << RosPrintf(it->first, "o0", 6) // << "]=" << RosPrintf(it->second, "o0", 6) << endl; if (dot != it->first || block.size() >= Connect().BlockSizeMax()) { @@ -1576,7 +1575,7 @@ bool RtclRw11Cpu::GetVarName(RtclArgs& args, const char* argname, size_t nind, std::vector& varname) { - while (varname.size() < nind+1) varname.push_back(string()); + while (varname.size() < nind+1) varname.emplace_back(string()); string name; if (!args.GetArg(argname, name)) return false; if (name.length()) { // if variable defined