Bug 930 - examples/topology-read/topology-example-sim.cc uses variable length array
This commit is contained in:
@@ -119,7 +119,7 @@ int main (int argc, char *argv[])
|
||||
int totlinks = inFile->LinksSize ();
|
||||
|
||||
NS_LOG_INFO ("creating node containers");
|
||||
NodeContainer nc[totlinks];
|
||||
NodeContainer* nc = new NodeContainer[totlinks];
|
||||
TopologyReader::ConstLinksIterator iter;
|
||||
int i = 0;
|
||||
for ( iter = inFile->LinksBegin (); iter != inFile->LinksEnd (); iter++, i++ )
|
||||
@@ -128,7 +128,7 @@ int main (int argc, char *argv[])
|
||||
}
|
||||
|
||||
NS_LOG_INFO ("creating net device containers");
|
||||
NetDeviceContainer ndc[totlinks];
|
||||
NetDeviceContainer* ndc = new NetDeviceContainer[totlinks];
|
||||
PointToPointHelper p2p;
|
||||
for (int i = 0; i < totlinks; i++)
|
||||
{
|
||||
@@ -140,7 +140,7 @@ int main (int argc, char *argv[])
|
||||
|
||||
// it crates little subnets, one for each couple of nodes.
|
||||
NS_LOG_INFO ("creating ipv4 interfaces");
|
||||
Ipv4InterfaceContainer ipic[totlinks];
|
||||
Ipv4InterfaceContainer* ipic = new Ipv4InterfaceContainer[totlinks];
|
||||
for (int i = 0; i < totlinks; i++)
|
||||
{
|
||||
ipic[i] = address.Assign (ndc[i]);
|
||||
@@ -200,6 +200,10 @@ int main (int argc, char *argv[])
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
delete[] ipic;
|
||||
delete[] ndc;
|
||||
delete[] nc;
|
||||
|
||||
NS_LOG_INFO ("Done.");
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user