performance efficiencies

This commit is contained in:
Jeff Young 2023-12-18 17:19:15 +00:00
parent 3aa20e2008
commit 68cbb820a7
11 changed files with 25 additions and 25 deletions

View File

@ -366,7 +366,7 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts, const std::string&
std::string theFile( reinterpret_cast<char *>( file ) ); std::string theFile( reinterpret_cast<char *>( file ) );
std::string theStyle( reinterpret_cast<char *>( style ) ); std::string theStyle( reinterpret_cast<char *>( style ) );
FONTINFO fontInfo( theFile, theStyle, theFamily ); FONTINFO fontInfo( std::move( theFile ), std::move( theStyle ), theFamily );
if( theFamily.length() > 0 && theFamily.front() == '.' ) if( theFamily.length() > 0 && theFamily.front() == '.' )
continue; continue;

View File

@ -205,7 +205,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
for( const auto& [ netname, color ] : m_NetColorAssignments ) for( const auto& [ netname, color ] : m_NetColorAssignments )
{ {
std::string key( netname.ToUTF8() ); std::string key( netname.ToUTF8() );
ret[key] = color; ret[ std::move( key ) ] = color;
} }
return ret; return ret;
@ -220,7 +220,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
for( const auto& pair : aJson.items() ) for( const auto& pair : aJson.items() )
{ {
wxString key( pair.key().c_str(), wxConvUTF8 ); wxString key( pair.key().c_str(), wxConvUTF8 );
m_NetColorAssignments[key] = pair.value().get<KIGFX::COLOR4D>(); m_NetColorAssignments[ std::move( key ) ] = pair.value().get<KIGFX::COLOR4D>();
} }
}, },
{} ) ); {} ) );
@ -233,7 +233,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
for( const auto& [ netname, netclassName ] : m_NetClassLabelAssignments ) for( const auto& [ netname, netclassName ] : m_NetClassLabelAssignments )
{ {
std::string key( netname.ToUTF8() ); std::string key( netname.ToUTF8() );
ret[key] = netclassName; ret[ std::move( key ) ] = netclassName;
} }
return ret; return ret;
@ -248,7 +248,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
for( const auto& pair : aJson.items() ) for( const auto& pair : aJson.items() )
{ {
wxString key( pair.key().c_str(), wxConvUTF8 ); wxString key( pair.key().c_str(), wxConvUTF8 );
m_NetClassLabelAssignments[key] = pair.value().get<wxString>(); m_NetClassLabelAssignments[ std::move( key ) ] = pair.value().get<wxString>();
} }
}, },
{} ) ); {} ) );
@ -265,7 +265,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
{ "netclass", netclassName.ToUTF8() } { "netclass", netclassName.ToUTF8() }
}; };
ret.push_back( pattern_json ); ret.push_back( std::move( pattern_json ) );
} }
return ret; return ret;

View File

@ -274,7 +274,7 @@ void RC_TREE_MODEL::rebuildModel( std::shared_ptr<RC_ITEMS_PROVIDER> aProvider,
BeforeReset(); BeforeReset();
m_rcItemsProvider = aProvider; m_rcItemsProvider = std::move( aProvider );
if( aSeverities != m_severities ) if( aSeverities != m_severities )
m_severities = aSeverities; m_severities = aSeverities;

View File

@ -874,7 +874,7 @@ template<typename ResultType>
ResultType JSON_SETTINGS::fetchOrDefault( const nlohmann::json& aJson, const std::string& aKey, ResultType JSON_SETTINGS::fetchOrDefault( const nlohmann::json& aJson, const std::string& aKey,
ResultType aDefault ) ResultType aDefault )
{ {
ResultType ret = aDefault; ResultType ret = std::move( aDefault );
try try
{ {

View File

@ -807,9 +807,9 @@ bool TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
// and transfer the previous view control settings to the new context // and transfer the previous view control settings to the new context
if( st->cofunc ) if( st->cofunc )
{ {
auto vc = st->vcSettings; KIGFX::VC_SETTINGS viewControlSettings = st->vcSettings;
st->Push(); st->Push();
st->vcSettings = vc; st->vcSettings = std::move( viewControlSettings );
} }
st->cofunc = new COROUTINE<int, const TOOL_EVENT&>( std::move( func_copy ) ); st->cofunc = new COROUTINE<int, const TOOL_EVENT&>( std::move( func_copy ) );

View File

@ -770,7 +770,7 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
try try
{ {
js[key_utf] = value; js[ std::move( key_utf ) ] = value;
} }
catch(...) catch(...)
{ {
@ -791,7 +791,7 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
try try
{ {
js[key_utf] = value; js[ std::move( key_utf ) ] = value;
} }
catch(...) catch(...)
{ {

View File

@ -53,7 +53,7 @@ public:
{ {
m_strokeCallback = std::move( aStrokeCallback ); m_strokeCallback = std::move( aStrokeCallback );
m_triangleCallback = []( const VECTOR2I&, const VECTOR2I&, const VECTOR2I& ) {}; m_triangleCallback = []( const VECTOR2I&, const VECTOR2I&, const VECTOR2I& ) {};
m_outlineCallback = std::move( aOutlineCallback; m_outlineCallback = std::move( aOutlineCallback );
m_stroke = true; m_stroke = true;
m_triangulate = false; m_triangulate = false;
} }

View File

@ -86,14 +86,14 @@ public:
{ {
} }
RC_ITEM( std::shared_ptr<RC_ITEM> aItem ) RC_ITEM( const std::shared_ptr<RC_ITEM>& aItem )
{ {
m_errorCode = aItem->m_errorCode; m_errorCode = aItem->m_errorCode;
m_errorMessage = aItem->m_errorMessage; m_errorMessage = aItem->m_errorMessage;
m_errorTitle = aItem->m_errorTitle; m_errorTitle = aItem->m_errorTitle;
m_settingsKey = aItem->m_settingsKey; m_settingsKey = aItem->m_settingsKey;
m_parent = aItem->m_parent; m_parent = aItem->m_parent;
m_ids = aItem->m_ids; m_ids = aItem->m_ids;
} }
virtual ~RC_ITEM() { } virtual ~RC_ITEM() { }
@ -195,7 +195,7 @@ class RC_TREE_NODE
public: public:
enum NODE_TYPE { MARKER, MAIN_ITEM, AUX_ITEM, AUX_ITEM2, AUX_ITEM3 }; enum NODE_TYPE { MARKER, MAIN_ITEM, AUX_ITEM, AUX_ITEM2, AUX_ITEM3 };
RC_TREE_NODE( RC_TREE_NODE* aParent, std::shared_ptr<RC_ITEM> aRcItem, NODE_TYPE aType ) : RC_TREE_NODE( RC_TREE_NODE* aParent, const std::shared_ptr<RC_ITEM>& aRcItem, NODE_TYPE aType ) :
m_Type( aType ), m_Type( aType ),
m_RcItem( aRcItem ), m_RcItem( aRcItem ),
m_Parent( aParent ) m_Parent( aParent )

View File

@ -90,17 +90,17 @@ public:
m_max(), m_max(),
m_use_minmax( false ), m_use_minmax( false ),
m_ptr( aPtr ), m_ptr( aPtr ),
m_default( aDefault ) m_default( std::move( aDefault ) )
{ } { }
PARAM( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault, ValueType aMin, PARAM( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault, ValueType aMin,
ValueType aMax, bool aReadOnly = false ) : ValueType aMax, bool aReadOnly = false ) :
PARAM_BASE( aJsonPath, aReadOnly ), PARAM_BASE( aJsonPath, aReadOnly ),
m_min( aMin ), m_min( std::move( aMin ) ),
m_max( aMax ), m_max( std::move( aMax ) ),
m_use_minmax( true ), m_use_minmax( true ),
m_ptr( aPtr ), m_ptr( aPtr ),
m_default( aDefault ) m_default( std::move( aDefault ) )
{ } { }
void Load( JSON_SETTINGS* aSettings, bool aResetIfMissing = true ) const override void Load( JSON_SETTINGS* aSettings, bool aResetIfMissing = true ) const override

View File

@ -126,7 +126,7 @@ private:
bool aCheckmark ) : bool aCheckmark ) :
m_type( ACTION ), m_type( ACTION ),
m_icon( static_cast<BITMAPS>( 0 ) ), m_icon( static_cast<BITMAPS>( 0 ) ),
m_condition( aCondition ), m_condition( std::move( aCondition ) ),
m_order( aOrder ), m_order( aOrder ),
m_isCheckmarkEntry( aCheckmark ) m_isCheckmarkEntry( aCheckmark )
{ {
@ -136,7 +136,7 @@ private:
ENTRY( ACTION_MENU* aMenu, SELECTION_CONDITION aCondition, int aOrder ) : ENTRY( ACTION_MENU* aMenu, SELECTION_CONDITION aCondition, int aOrder ) :
m_type( MENU ), m_type( MENU ),
m_icon( static_cast<BITMAPS>( 0 ) ), m_icon( static_cast<BITMAPS>( 0 ) ),
m_condition( aCondition ), m_condition( std::move( aCondition ) ),
m_order( aOrder ), m_order( aOrder ),
m_isCheckmarkEntry( false ) m_isCheckmarkEntry( false )
{ {
@ -147,7 +147,7 @@ private:
SELECTION_CONDITION aCondition, int aOrder, bool aCheckmark ) : SELECTION_CONDITION aCondition, int aOrder, bool aCheckmark ) :
m_type( WXITEM ), m_type( WXITEM ),
m_icon( aBitmap ), m_icon( aBitmap ),
m_condition( aCondition ), m_condition( std::move( aCondition ) ),
m_order( aOrder ), m_order( aOrder ),
m_isCheckmarkEntry( aCheckmark ) m_isCheckmarkEntry( aCheckmark )
{ {
@ -160,7 +160,7 @@ private:
m_type( SEPARATOR ), m_type( SEPARATOR ),
m_icon( static_cast<BITMAPS>( 0 ) ), m_icon( static_cast<BITMAPS>( 0 ) ),
m_data(), m_data(),
m_condition( aCondition ), m_condition( std::move( aCondition ) ),
m_order( aOrder ), m_order( aOrder ),
m_isCheckmarkEntry( false ) m_isCheckmarkEntry( false )
{ {

View File

@ -471,7 +471,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
DS_PROXY_UNDO_ITEM alt_item( this ); DS_PROXY_UNDO_ITEM alt_item( this );
DS_PROXY_UNDO_ITEM* item = static_cast<DS_PROXY_UNDO_ITEM*>( eda_item ); DS_PROXY_UNDO_ITEM* item = static_cast<DS_PROXY_UNDO_ITEM*>( eda_item );
item->Restore( this ); item->Restore( this );
*item = alt_item; *item = std::move( alt_item );
break; break;
} }