From 957c6ec4170befdf1461c8e458d30297b0d9360c Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 11 Aug 2016 14:42:17 +0200 Subject: [PATCH] Removed hard limit for ngspice netlist --- eeschema/sim/ngspice.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp index 40ab66a89b..dacc729e08 100644 --- a/eeschema/sim/ngspice.cpp +++ b/eeschema/sim/ngspice.cpp @@ -217,26 +217,24 @@ vector NGSPICE::GetPhasePlot( const string& aName, int aMaxLen ) bool NGSPICE::LoadNetlist( const string& aNetlist ) { - // TODO remove the hard limit - char* lines[16384]; + vector lines; stringstream ss( aNetlist ); - int n = 0; - while( !ss.eof() && n < 16384 ) + while( !ss.eof() ) { char line[1024]; - ss.getline( line, sizeof(line) ); - lines[n++] = strdup(line); - + ss.getline( line, sizeof( line ) ); + lines.push_back( strdup( line ) ); } - lines[n] = NULL; + + lines.push_back( nullptr ); setlocale( LC_ALL, "C" ); - m_ngSpice_Circ( lines ); + m_ngSpice_Circ( lines.data() ); setlocale( LC_ALL, "" ); - for(int i = 0; i < n; i++) - delete lines[i]; + for( auto line : lines ) + delete line; return true; }