Commit 3c7b7a77 authored by rdubner's avatar rdubner

Get rid of N*N/2 loop when building VARIABLE_STRING_xxx

parent c183e944
...@@ -105,7 +105,6 @@ CreateSymc(PARAMETERS &params, ...@@ -105,7 +105,6 @@ CreateSymc(PARAMETERS &params,
*/ */
string fname = params.cbl_filename.GetFandExt(); string fname = params.cbl_filename.GetFandExt();
stringstream ss_tab;
stringstream ss; stringstream ss;
// Start off the output with the program section information: // Start off the output with the program section information:
...@@ -133,12 +132,15 @@ CreateSymc(PARAMETERS &params, ...@@ -133,12 +132,15 @@ CreateSymc(PARAMETERS &params,
ss << "char VARIABLE_STRING_" << Upper(fname) << "[]=" << endl; ss << "char VARIABLE_STRING_" << Upper(fname) << "[]=" << endl;
const int SEGMENT_LENGTH = 78; const int SEGMENT_LENGTH = 78;
while(s.length() > SEGMENT_LENGTH) { int walker = 0;
ss << "\"" << s.substr(0,SEGMENT_LENGTH) << "\"" << endl; int remaining = (int)s.length();
s = s.substr(SEGMENT_LENGTH); while( remaining > SEGMENT_LENGTH ) {
ss << "\"" << s.substr(walker,SEGMENT_LENGTH) << "\"" << endl;
walker += SEGMENT_LENGTH;
remaining -= SEGMENT_LENGTH;
} }
if( s.length() ) { if( remaining ) {
ss << "\"" << s << "\"" << endl; ss << "\"" << s.substr(walker) << "\"" << endl;
} }
ss << ";" << endl << endl; ss << ";" << endl << endl;
params.symc << ss.str(); params.symc << ss.str();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment