Use const references where possible
This avoids copy cost on local vars where we only read.
This commit is contained in:
parent
c6f5df134c
commit
6983c56cf8
|
@ -186,17 +186,17 @@ void C3D_RENDER_OGL_LEGACY::add_object_to_triangle_layer( const CROUNDSEGMENT2D
|
|||
float aZtop,
|
||||
float aZbot )
|
||||
{
|
||||
const SFVEC2F leftStart = aSeg->GetLeftStar();
|
||||
const SFVEC2F leftEnd = aSeg->GetLeftEnd();
|
||||
const SFVEC2F leftDir = aSeg->GetLeftDir();
|
||||
const SFVEC2F& leftStart = aSeg->GetLeftStar();
|
||||
const SFVEC2F& leftEnd = aSeg->GetLeftEnd();
|
||||
const SFVEC2F& leftDir = aSeg->GetLeftDir();
|
||||
|
||||
const SFVEC2F rightStart = aSeg->GetRightStar();
|
||||
const SFVEC2F rightEnd = aSeg->GetRightEnd();
|
||||
const SFVEC2F rightDir = aSeg->GetRightDir();
|
||||
const SFVEC2F& rightStart = aSeg->GetRightStar();
|
||||
const SFVEC2F& rightEnd = aSeg->GetRightEnd();
|
||||
const SFVEC2F& rightDir = aSeg->GetRightDir();
|
||||
const float radius = aSeg->GetRadius();
|
||||
|
||||
const SFVEC2F start = aSeg->GetStart();
|
||||
const SFVEC2F end = aSeg->GetEnd();
|
||||
const SFVEC2F& start = aSeg->GetStart();
|
||||
const SFVEC2F& end = aSeg->GetEnd();
|
||||
|
||||
const float texture_factor = (12.0f / (float)SIZE_OF_CIRCLE_TEXTURE) + 1.0f;
|
||||
const float texture_factorF= ( 6.0f / (float)SIZE_OF_CIRCLE_TEXTURE) + 1.0f;
|
||||
|
|
|
@ -218,8 +218,8 @@ void OGL_Draw_segment( const CROUNDSEGMENT2D &aSegment,
|
|||
{
|
||||
glPushMatrix();
|
||||
|
||||
const SFVEC2F start = aSegment.GetStart();
|
||||
const SFVEC2F end_minus_start = aSegment.GetEnd_minus_Start();
|
||||
const SFVEC2F& start = aSegment.GetStart();
|
||||
const SFVEC2F& end_minus_start = aSegment.GetEnd_minus_Start();
|
||||
const float radius = aSegment.GetRadius();
|
||||
const float width = aSegment.GetWidth();
|
||||
const float length = aSegment.GetLength();
|
||||
|
|
|
@ -62,7 +62,7 @@ wxString EDA_FILE_SELECTOR( const wxString& aTitle,
|
|||
{
|
||||
wxString fullfilename;
|
||||
wxString curr_cwd = wxGetCwd();
|
||||
wxString defaultname = aFileName;
|
||||
const wxString& defaultname = aFileName;
|
||||
wxString defaultpath = aPath;
|
||||
wxString dotted_Ext = wxT(".") + aExtension;
|
||||
|
||||
|
@ -209,7 +209,7 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para
|
|||
bool OpenPDF( const wxString& file )
|
||||
{
|
||||
wxString command;
|
||||
wxString filename = file;
|
||||
const wxString& filename = file;
|
||||
|
||||
Pgm().ReadPdfBrowserInfos();
|
||||
|
||||
|
|
|
@ -546,7 +546,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets( bool aUseGraph )
|
|||
auto pin = static_cast<SCH_PIN*>( item );
|
||||
|
||||
auto refText = pin->GetParentComponent()->GetRef( &sheet );
|
||||
auto pinText = pin->GetNumber();
|
||||
const auto& pinText = pin->GetNumber();
|
||||
|
||||
// Skip power symbols and virtual components
|
||||
if( refText[0] == wxChar( '#' ) )
|
||||
|
|
|
@ -348,7 +348,7 @@ bool NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
|
|||
if( fieldSeq )
|
||||
{
|
||||
// Get the string containing the sequence of nodes:
|
||||
const wxString nodeSeqIndexLineStr = fieldSeq->GetText();
|
||||
const wxString& nodeSeqIndexLineStr = fieldSeq->GetText();
|
||||
|
||||
// Verify field exists and is not empty:
|
||||
if( !nodeSeqIndexLineStr.IsEmpty() )
|
||||
|
|
|
@ -367,7 +367,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
|||
|
||||
for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
|
||||
{
|
||||
LIB_ID part_id = each_component->GetLibId();
|
||||
const LIB_ID& part_id = each_component->GetLibId();
|
||||
|
||||
if( old_part_id != part_id )
|
||||
{
|
||||
|
|
|
@ -830,7 +830,7 @@ void EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLib, const wxString* aLibName )
|
|||
)
|
||||
{
|
||||
wxString lib = aLibName ? *aLibName : m_lib_path;
|
||||
wxString pkg = pack_ref;
|
||||
const wxString& pkg = pack_ref;
|
||||
|
||||
wxString emsg = wxString::Format(
|
||||
_( "<package> name: \"%s\" duplicated in eagle <library>: \"%s\"" ),
|
||||
|
|
|
@ -385,7 +385,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb )
|
|||
|
||||
bool FOOTPRINT_EDIT_FRAME::SaveLibraryAs( const wxString& aLibraryPath )
|
||||
{
|
||||
wxString curLibPath = aLibraryPath;
|
||||
const wxString& curLibPath = aLibraryPath;
|
||||
wxString dstLibPath = CreateNewLibrary();
|
||||
|
||||
if( !dstLibPath )
|
||||
|
|
|
@ -39,7 +39,7 @@ INDEX::ITEM_SHAPE_INDEX* INDEX::getSubindex( const ITEM* aItem )
|
|||
{
|
||||
int idx_n = -1;
|
||||
|
||||
const LAYER_RANGE l = aItem->Layers();
|
||||
const LAYER_RANGE& l = aItem->Layers();
|
||||
|
||||
switch( aItem->Kind() )
|
||||
{
|
||||
|
|
|
@ -177,7 +177,7 @@ int INDEX::Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor )
|
|||
|
||||
total += querySingle( SI_Multilayer, shape, aMinDistance, aVisitor );
|
||||
|
||||
const LAYER_RANGE layers = aItem->Layers();
|
||||
const LAYER_RANGE& layers = aItem->Layers();
|
||||
|
||||
if( layers.IsMultilayer() )
|
||||
{
|
||||
|
|
|
@ -291,7 +291,7 @@ void ZONE_CREATE_HELPER::OnComplete( const POLYGON_GEOM_MANAGER& aMgr )
|
|||
// 45 constraint
|
||||
if( aMgr.GetLeaderMode() == POLYGON_GEOM_MANAGER::LEADER_MODE::DEG45 )
|
||||
{
|
||||
auto pts = aMgr.GetLeaderLinePoints();
|
||||
const auto& pts = aMgr.GetLeaderLinePoints();
|
||||
for( int i = 1; i < pts.PointCount(); i++ )
|
||||
outline->Append( pts.CPoint( i ) );
|
||||
}
|
||||
|
|
|
@ -580,7 +580,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
TopoDS_Iterator it;
|
||||
IFSG_TRANSFORM childNode( parent );
|
||||
SGNODE* pptr = childNode.GetRawPtr();
|
||||
TopLoc_Location loc = shape.Location();
|
||||
const TopLoc_Location& loc = shape.Location();
|
||||
bool ret = false;
|
||||
|
||||
if( !loc.IsIdentity() )
|
||||
|
@ -634,7 +634,7 @@ bool processComp( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
TopoDS_Iterator it;
|
||||
IFSG_TRANSFORM childNode( parent );
|
||||
SGNODE* pptr = childNode.GetRawPtr();
|
||||
TopLoc_Location loc = shape.Location();
|
||||
const TopLoc_Location& loc = shape.Location();
|
||||
bool ret = false;
|
||||
|
||||
if( !loc.IsIdentity() )
|
||||
|
|
Loading…
Reference in New Issue