Commit f92ff550 authored by Chad Barb's avatar Chad Barb
Browse files

Minor fix.

parent 7f0157b2
...@@ -141,9 +141,6 @@ ...@@ -141,9 +141,6 @@
// BAM! // BAM!
using namespace std; using namespace std;
// keep freebsd from mumbling about gets(3) being unsafe.
#define gets( x ) fgets( x, sizeof( x ), stdin )
// some code to enable when the solver wedges and we don't know why. // some code to enable when the solver wedges and we don't know why.
#ifdef DEBUG #ifdef DEBUG
int wedgecount; int wedgecount;
...@@ -652,13 +649,13 @@ int main( int argc, char ** argv ) ...@@ -652,13 +649,13 @@ int main( int argc, char ** argv )
{ {
if (verbose > 1) { printf("How many physical nodes?\n"); } if (verbose > 1) { printf("How many physical nodes?\n"); }
gets( line ); fgets( line, sizeof( line ), stdin );
sscanf( line, "%i", &pnodes ); sscanf( line, "%i", &pnodes );
if (verbose > 1) { printf("Okay, enter %i names for the physical nodes, one per line.\n", pnodes ); } if (verbose > 1) { printf("Okay, enter %i names for the physical nodes, one per line.\n", pnodes ); }
for (int i = 0; i < pnodes; i++) { for (int i = 0; i < pnodes; i++) {
char name[1024]; char name[1024];
gets( line ); fgets( line, sizeof( line ), stdin );
sscanf( line, "%s", name ); sscanf( line, "%s", name );
pnodeNames[i] = string( name ); pnodeNames[i] = string( name );
reversePNodeNames[string(name)] = i; reversePNodeNames[string(name)] = i;
...@@ -669,7 +666,7 @@ int main( int argc, char ** argv ) ...@@ -669,7 +666,7 @@ int main( int argc, char ** argv )
" maximum number of virtual nodes allowed on each" " maximum number of virtual nodes allowed on each"
" physical node.\n", pnodes ); } " physical node.\n", pnodes ); }
for (int i = 0; i < pnodes; i++) { for (int i = 0; i < pnodes; i++) {
gets( line ); fgets( line, sizeof( line ), stdin );
sscanf( line, "%i", &(maxplex[i])); sscanf( line, "%i", &(maxplex[i]));
available += maxplex[i]; available += maxplex[i];
} }
...@@ -686,7 +683,7 @@ int main( int argc, char ** argv ) ...@@ -686,7 +683,7 @@ int main( int argc, char ** argv )
} }
for (int y = 0; y < pnodes; y++) { for (int y = 0; y < pnodes; y++) {
char * linePos = line; char * linePos = line;
gets( line ); fgets( line, sizeof( line ), stdin );
while (*linePos == ' ') { linePos++; } // skip leading whitespace while (*linePos == ' ') { linePos++; } // skip leading whitespace
for (int x = 0; x < pnodes; x++) { for (int x = 0; x < pnodes; x++) {
float temp; float temp;
...@@ -708,7 +705,7 @@ int main( int argc, char ** argv ) ...@@ -708,7 +705,7 @@ int main( int argc, char ** argv )
{ {
if (verbose > 1) { printf("How many virtual nodes?\n"); } if (verbose > 1) { printf("How many virtual nodes?\n"); }
gets( line ); fgets( line, sizeof( line ), stdin );
sscanf( line, "%i", &vnodes ); sscanf( line, "%i", &vnodes );
if (vnodes > available) { if (vnodes > available) {
...@@ -725,7 +722,7 @@ int main( int argc, char ** argv ) ...@@ -725,7 +722,7 @@ int main( int argc, char ** argv )
for (int i = 0; i < vnodes; i++) { for (int i = 0; i < vnodes; i++) {
char name[1024]; char name[1024];
char pname[1024]; char pname[1024];
gets( line ); fgets( line, sizeof( line ), stdin );
if (sscanf( line, "%s %s", name, pname ) == 2) { if (sscanf( line, "%s %s", name, pname ) == 2) {
map< string, int >::iterator it = reversePNodeNames.find( string( pname ) ); map< string, int >::iterator it = reversePNodeNames.find( string( pname ) );
if (it == reversePNodeNames.end()) { if (it == reversePNodeNames.end()) {
...@@ -750,7 +747,7 @@ int main( int argc, char ** argv ) ...@@ -750,7 +747,7 @@ int main( int argc, char ** argv )
} }
for (int y = 0; y < vnodes; y++) { for (int y = 0; y < vnodes; y++) {
char * linePos = line; char * linePos = line;
gets( line ); fgets( line, sizeof( line ), stdin );
while (*linePos == ' ') { linePos++; } // skip leading whitespace while (*linePos == ' ') { linePos++; } // skip leading whitespace
for (int x = 0; x < vnodes; x++) { for (int x = 0; x < vnodes; x++) {
float temp; float temp;
...@@ -833,9 +830,9 @@ int main( int argc, char ** argv ) ...@@ -833,9 +830,9 @@ int main( int argc, char ** argv )
&(currentPool[pickABest( currentPool )]) ); &(currentPool[pickABest( currentPool )]) );
} }
if (stddev < 0.1f) { //if (stddev < (avg / 10.0f))) {
himutate = false; himutate = false;
} //}
sortByError( nextPool ); sortByError( nextPool );
......
Supports Markdown
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