From 5e7c4b734c1dbe646e10e03b3c27d076a7673a8a Mon Sep 17 00:00:00 2001 From: Alex <dudesuchamazing@gmail.com> Date: Thu, 17 Nov 2022 02:09:46 +0500 Subject: [PATCH] Small optimizations in DRC and SHAPE_POLY_SET. --- common/libeval_compiler/libeval_compiler.cpp | 4 ++-- libs/kimath/src/geometry/shape_poly_set.cpp | 2 ++ pcbnew/drc/drc_engine.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/libeval_compiler/libeval_compiler.cpp b/common/libeval_compiler/libeval_compiler.cpp index 86cc4480f5..2b5e59928b 100644 --- a/common/libeval_compiler/libeval_compiler.cpp +++ b/common/libeval_compiler/libeval_compiler.cpp @@ -2,7 +2,7 @@ * This file is part of libeval, a simple math expression evaluator * * Copyright (C) 2017 Michael Geselbracht, mgeselbracht3@gmail.com - * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -124,7 +124,7 @@ bool VALUE::EqualTo( CONTEXT* aCtx, const VALUE* b ) const if( b->m_stringIsWildcard ) return WildCompareString( b->AsString(), AsString(), false ); else - return !AsString().CmpNoCase( b->AsString() ); + return AsString().IsSameAs( b->AsString(), false ); } return false; diff --git a/libs/kimath/src/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp index 129613541f..e4a80a50fe 100644 --- a/libs/kimath/src/geometry/shape_poly_set.cpp +++ b/libs/kimath/src/geometry/shape_poly_set.cpp @@ -95,6 +95,8 @@ SHAPE_POLY_SET::SHAPE_POLY_SET( const SHAPE_POLY_SET& aOther ) : { if( aOther.IsTriangulationUpToDate() ) { + m_triangulatedPolys.reserve( aOther.TriangulatedPolyCount() ); + for( unsigned i = 0; i < aOther.TriangulatedPolyCount(); i++ ) { const TRIANGULATED_POLYGON* poly = aOther.TriangulatedPolygon( i ); diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index dcf4c3971f..8201592ff8 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -1720,7 +1720,7 @@ int DRC_ENGINE::MatchDpSuffix( const wxString& aNetName, wxString& aComplementNe if( rv != 0 && count >= 1 ) { aBaseDpName = aNetName.Left( aNetName.Length() - count ); - aComplementNet = aBaseDpName + aComplementNet + aNetName.Right( count - 1 ); + aComplementNet = wxString( aBaseDpName ) << aComplementNet << aNetName.Right( count - 1 ); } return rv;