Changeset f75030 for molecuilder/src/moleculelist.cpp
- Timestamp:
- May 23, 2008, 9:17:19 AM (17 years ago)
- Children:
- 6145aa7
- Parents:
- 6c96f4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified molecuilder/src/moleculelist.cpp ¶
r6c96f4 rf75030 22 22 { 23 23 ListOfMolecules = (molecule **) Malloc(sizeof(molecule *)*NumMolecules, "MoleculeListClass:MoleculeListClass: **ListOfMolecules"); 24 for (int i= 0;i<NumMolecules;i++)24 for (int i=NumMolecules;i--;) 25 25 ListOfMolecules[i] = NULL; 26 26 NumberOfMolecules = NumMolecules; … … 34 34 { 35 35 cout << Verbose(3) << this << ": Freeing ListOfMolcules." << endl; 36 for (int i= 0;i<NumberOfMolecules;i++) {36 for (int i=NumberOfMolecules;i--;) { 37 37 if (ListOfMolecules[i] != NULL) { // if NULL don't free 38 38 cout << Verbose(4) << "ListOfMolecules: Freeing " << ListOfMolecules[i] << "." << endl; … … 66 66 else { 67 67 Count = (**(molecule **)a).AtomCount; 68 aList = (int *) Malloc(sizeof(int)*Count, "MolCompare: *aList");69 bList = (int *) Malloc(sizeof(int)*Count, "MolCompare: *bList");68 aList = new int[Count]; 69 bList = new int[Count]; 70 70 71 71 // fill the lists … … 114 114 } 115 115 } 116 Free((void **)&aList, "MolCompare: *aList");117 Free((void **)&bList, "MolCompare: *bList");116 delete[](aList); 117 delete[](bList); 118 118 return flag; 119 119 } … … 244 244 ListOfMolecules[i]->SetBoxDimension(&BoxDimension); // update Box of atoms by boundary 245 245 int j = -1; 246 for (int k=0;k< 3;k++) {246 for (int k=0;k<NDIM;k++) { 247 247 j += k+1; 248 248 BoxDimension.x[k] = 5.; … … 268 268 outputFragment.close(); 269 269 outputFragment.clear(); 270 Free((void **)&FragmentNumber, "MoleculeListClass::OutputConfigForListOfFragments: *FragmentNumber"); 270 delete(FragmentNumber); 271 //Free((void **)&FragmentNumber, "MoleculeListClass::OutputConfigForListOfFragments: *FragmentNumber"); 271 272 } 272 273 cout << " done." << endl; … … 461 462 ListOfLocalAtoms = (atom ***) Malloc(sizeof(atom **)*Counter, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms"); 462 463 if (ListOfLocalAtoms != NULL) { 463 for (int i= 0;i<Counter;i++)464 for (int i=Counter;i--;) 464 465 ListOfLocalAtoms[i] = NULL; 465 466 FreeList = FreeList && true; … … 501 502 KeySetCounter = Count(); 502 503 FragmentList = (Graph **) Malloc(sizeof(Graph *)*KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList"); 503 for(int i= 0;i<KeySetCounter;i++)504 for(int i=KeySetCounter;i--;) 504 505 FragmentList[i] = NULL; 505 506 KeySetCounter = 0;
Note:
See TracChangeset
for help on using the changeset viewer.